Skip to content

Commit

Permalink
git-svn-id: svn://cherokee-project.com/cherokee/trunk@1577 5dc97367-9…
Browse files Browse the repository at this point in the history
…7f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jun 18, 2008
1 parent cd1d63c commit 470e138
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,5 +1,11 @@
2008-06-18 Alvaro Lopez Ortega <alvaro@alobbs.com>

* 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.

Expand Down
33 changes: 21 additions & 12 deletions admin/CherokeeManagement.py
Expand Up @@ -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
Expand All @@ -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)
9 changes: 8 additions & 1 deletion admin/PageAdvanced.py
Expand Up @@ -4,6 +4,7 @@
from Table import *
from Form import *
from consts import *
from CherokeeManagement import *

DATA_VALIDATION = [
("server!fdlimit", validations.is_positive_int),
Expand Down Expand Up @@ -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 = "<h1>Advanced configuration</h1>"
txt += self.Dialog(WARNING, 'warning')

Expand All @@ -61,7 +68,7 @@ def _render_content (self):

txt += "<h2>Server tweaking</h2>"
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)
Expand Down
2 changes: 1 addition & 1 deletion cherokee/info.c
Expand Up @@ -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
Expand Down

0 comments on commit 470e138

Please sign in to comment.