diff --git a/ChangeLog b/ChangeLog index 291b70681..9a1f14598 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-06-18 Alvaro Lopez Ortega + * admin/CherokeeManagement.py (cherokee_has_polling_method), + admin/PageAdvanced.py (PageAdvanced._render_content): It shows + only the Polling methods that are available. It does not make + sense to show "Solaris ports" or "Select Win32" on MacOS X, for + instance. + * cherokee/info.c (cherokee_info_build_print): Print the polling method like the built-in plug-ins so it is easier to parse. diff --git a/admin/CherokeeManagement.py b/admin/CherokeeManagement.py index e4f1e4a5c..b60fcac9b 100644 --- a/admin/CherokeeManagement.py +++ b/admin/CherokeeManagement.py @@ -221,15 +221,8 @@ def cherokee_get_server_info (): _built_in_list = [] _built_in_list_done = False -def cherokee_has_plugin (module): - # Check for the dynamic plug-in - try: - mods = filter(lambda x: module in x, os.listdir(CHEROKEE_PLUGINDIR)) - if len(mods) >= 1: - return True - except: - pass +def cherokee_build_info_has (filter, module): # Let's see whether it's built-in global _built_in_list global _built_in_list_done @@ -243,13 +236,29 @@ def cherokee_has_plugin (module): f.close() except: pass - + try: - line = filter(lambda x: x.startswith (" Built-in: "), cont.split("\n"))[0] - line = line.replace(" Built-in: ", "") + filter_string = " %s: " % (filter) + for l in cont.split("\n"): + if l.startswith(filter_string): + line = l.replace (filter_string, "") + break _built_in_list = line.split(" ") except: pass return module in _built_in_list - + +def cherokee_has_plugin (module): + # Check for the dynamic plug-in + try: + mods = filter(lambda x: module in x, os.listdir(CHEROKEE_PLUGINDIR)) + if len(mods) >= 1: + return True + except: + pass + + return cherokee_build_info_has ("Built-in", module) + +def cherokee_has_polling_method (module): + return cherokee_build_info_has ("Polling methods", module) diff --git a/admin/PageAdvanced.py b/admin/PageAdvanced.py index 635c7f732..d0f8f1a3a 100644 --- a/admin/PageAdvanced.py +++ b/admin/PageAdvanced.py @@ -4,6 +4,7 @@ from Table import * from Form import * from consts import * +from CherokeeManagement import * DATA_VALIDATION = [ ("server!fdlimit", validations.is_positive_int), @@ -49,6 +50,12 @@ def _op_render (self): return Page.Render(self) def _render_content (self): + polling_methods = [] + for name, desc in POLL_METHODS: + if ((not name) or \ + cherokee_has_polling_method (name)): + polling_methods.append((name, desc)) + txt = "

Advanced configuration

" txt += self.Dialog(WARNING, 'warning') @@ -61,7 +68,7 @@ def _render_content (self): txt += "

Server tweaking

" table = TableProps() - self.AddPropOptions (table, 'Polling Method', 'server!poll_method', POLL_METHODS, NOTE_POLLING) + self.AddPropOptions (table, 'Polling Method', 'server!poll_method', polling_methods, NOTE_POLLING) self.AddPropEntry (table, 'Sendfile min size', 'server!sendfile_min', NOTE_SENDFILE_MIN) self.AddPropEntry (table, 'Sendfile max size', 'server!sendfile_max', NOTE_SENDFILE_MAX) self.AddPropEntry (table, 'Panic action', 'server!panic_action', NOTE_PANIC_ACTION) diff --git a/cherokee/info.c b/cherokee/info.c index ae45e295e..857adb4d7 100644 --- a/cherokee/info.c +++ b/cherokee/info.c @@ -97,7 +97,7 @@ cherokee_info_build_print (cherokee_server_t *srv) printf (" syslog(): no\n"); #endif - printf (" polling methods: "); + printf (" Polling methods: "); #ifdef HAVE_PORT printf ("ports "); #endif