Changeset 1577

Show
Ignore:
Timestamp:
06/18/08 21:18:39 (3 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1576 r1577  
    112008-06-18  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * admin/CherokeeManagement.py (cherokee_has_polling_method), 
     4        admin/PageAdvanced.py (PageAdvanced._render_content): It shows 
     5        only the Polling methods that are available. It does not make 
     6        sense to show "Solaris ports" or "Select Win32" on MacOS X, for 
     7        instance. 
    28 
    39        * cherokee/info.c (cherokee_info_build_print): Print the polling 
  • cherokee/trunk/admin/CherokeeManagement.py

    r1518 r1577  
    222222_built_in_list_done = False 
    223223 
     224 
     225def cherokee_build_info_has (filter, module): 
     226    # Let's see whether it's built-in 
     227    global _built_in_list 
     228    global _built_in_list_done 
     229 
     230    if not _built_in_list_done: 
     231        _built_in_list_done = True 
     232 
     233        try: 
     234            f = os.popen ("%s -i" % (CHEROKEE_SRV_PATH)) 
     235            cont = f.read() 
     236            f.close() 
     237        except: 
     238            pass 
     239 
     240        try: 
     241            filter_string = " %s: " % (filter) 
     242            for l in cont.split("\n"): 
     243                if l.startswith(filter_string): 
     244                    line = l.replace (filter_string, "") 
     245                    break 
     246            _built_in_list = line.split(" ") 
     247        except: 
     248            pass 
     249 
     250    return module in _built_in_list 
     251 
    224252def cherokee_has_plugin (module): 
    225253    # Check for the dynamic plug-in 
     
    231259        pass 
    232260 
    233     # Let's see whether it's built-in 
    234     global _built_in_list 
    235     global _built_in_list_done 
    236  
    237     if not _built_in_list_done: 
    238         _built_in_list_done = True 
    239  
    240         try: 
    241             f = os.popen ("%s -i" % (CHEROKEE_SRV_PATH)) 
    242             cont = f.read() 
    243             f.close() 
    244         except: 
    245             pass 
    246          
    247         try: 
    248             line = filter(lambda x: x.startswith (" Built-in: "), cont.split("\n"))[0] 
    249             line = line.replace(" Built-in: ", "") 
    250             _built_in_list = line.split(" ") 
    251         except: 
    252             pass 
    253  
    254     return module in _built_in_list 
    255      
     261    return cherokee_build_info_has ("Built-in", module) 
     262 
     263def cherokee_has_polling_method (module): 
     264    return cherokee_build_info_has ("Polling methods", module) 
  • cherokee/trunk/admin/PageAdvanced.py

    r1435 r1577  
    55from Form import * 
    66from consts import * 
     7from CherokeeManagement import * 
    78 
    89DATA_VALIDATION = [ 
     
    5051 
    5152    def _render_content (self): 
     53        polling_methods = [] 
     54        for name, desc in POLL_METHODS: 
     55            if ((not name) or \ 
     56                cherokee_has_polling_method (name)): 
     57                polling_methods.append((name, desc)) 
     58 
    5259        txt = "<h1>Advanced configuration</h1>" 
    5360        txt += self.Dialog(WARNING, 'warning') 
     
    6269        txt += "<h2>Server tweaking</h2>" 
    6370        table = TableProps() 
    64         self.AddPropOptions  (table, 'Polling Method',    'server!poll_method',  POLL_METHODS, NOTE_POLLING) 
     71        self.AddPropOptions  (table, 'Polling Method',    'server!poll_method',  polling_methods, NOTE_POLLING) 
    6572        self.AddPropEntry    (table, 'Sendfile min size', 'server!sendfile_min', NOTE_SENDFILE_MIN) 
    6673        self.AddPropEntry    (table, 'Sendfile max size', 'server!sendfile_max', NOTE_SENDFILE_MAX) 
  • cherokee/trunk/cherokee/info.c

    r1576 r1577  
    9898#endif 
    9999 
    100         printf (" polling methods: "); 
     100        printf (" Polling methods: "); 
    101101#ifdef HAVE_PORT 
    102102        printf ("ports ");