Permalink
Browse files

git-svn-id: svn://cherokee-project.com/cherokee/trunk@3258 5dc97367-9…

…7f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent 94c3f1c commit 6af69c513e546940efbf8cd32b41b183195ae1ab @alobbs alobbs committed May 25, 2009
Showing with 14 additions and 6 deletions.
  1. +9 −2 admin/Wizard.py
  2. +5 −4 admin/Wizard_PHP.py
View
11 admin/Wizard.py
@@ -16,8 +16,15 @@ def run (self, uri, post):
self.show()
return self._run(uri, post)
- def error (self, msg):
- print "ERROR!! %s" % (msg)
+ def report_error (self, msg, desc=''):
+ content = '<h1>Wizard: %s</h1>' % (self.name)
+ content += '<div class="dialog-error">%s</div>' % (msg)
+ content += '<div class="indented">%s</div>'% (desc)
+
+ page = PageMenu ("wizard_error", self._cfg)
+ page.AddMacroContent ('title', "%s error"%(self.name))
+ page.AddMacroContent ('content', content)
+ return page.Render()
class WizardManager:
def __init__ (self, cfg, _type, pre):
View
9 admin/Wizard_PHP.py
@@ -5,6 +5,7 @@
class Wizard_Rules_PHP (Wizard):
UNIX_SOCK = "/tmp/cherokee-php.socket"
DEFAULT_PATHS = ['/usr/bin', '/opt/php', '/usr/sfw/bin', '/usr/gnu/bin']
+ DEFAULT_BINS = ['php-cgi', 'php']
ICON = "php.jpg"
DESC = "Configures PHP in the current Virtual Server. It will add a new .php extension is not present."
@@ -43,12 +44,12 @@ def test_php_fcgi (path):
# Add a new Source, if needed
if not self.source:
- php_path = path_find_binary (['php-cgi', 'php'],
+ php_path = path_find_binary (self.DEFAULT_BINS,
extra_dirs = self.DEFAULT_PATHS,
custom_test = test_php_fcgi)
if not php_path:
- self.error ("Couldn't find a suitable PHP interpreter.")
- return
+ desc = "<p>Looked for the binaries: %s.</p>" % (", ".join(self.DEFAULT_BINS))
+ return self.report_error ("Couldn't find a suitable PHP interpreter.", desc)
self.source = cfg_source_get_next (self._cfg)
self._cfg['%s!nick' % (self.source)] = 'PHP Interpreter'
@@ -63,7 +64,7 @@ def test_php_fcgi (path):
if not self.rule:
self.rule = cfg_vsrv_rule_get_next (self._cfg, self._pre)
if not self.rule:
- self.error ("Couldn't add a new rule.")
+ return self.report_error ("Couldn't add a new rule.")
src_num = self.source.split('!')[-1]

0 comments on commit 6af69c5

Please sign in to comment.