Changeset 2869

Show
Ignore:
Timestamp:
18/02/09 23:48:29 (1 year ago)
Author:
alo
Message:

--

Files:

Legend:

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

    r2868 r2869  
     12009-02-18  Alvaro Lopez Ortega  <alvaro@octality.com> 
     2 
     3        * admin/ModuleDirlist.py, admin/PageAdvanced.py, 
     4        admin/ModuleCgi.py, admin/PageVServers.py, admin/ModuleCommon.py, 
     5        admin/ModuleStreaming.py, admin/ModuleBalancer.py, 
     6        admin/PageMime.py, admin/PageVServer.py, admin/validations.py, 
     7        admin/ModuleDirlist.py, admin/ModuleHtdigest.py, 
     8        admin/ModuleHtpasswd.py, admin/PageEntry.py: Adds a new entry 
     9        validations that were missing. 
     10 
    1112009-02-17  Alvaro Lopez Ortega  <alvaro@octality.com> 
    212 
  • cherokee/trunk/admin/ModuleAuth.py

    r2094 r2869  
    77 
    88DATA_VALIDATION = [ 
    9     ('vserver!.*?!(directory|extensions|request)!.*?!auth!users', validations.is_safe_id_list) 
     9    ('vserver!.*?!rule!.*?!auth!users', validations.is_safe_id_list) 
    1010] 
    1111 
     
    3636        table = TableProps() 
    3737        self.AddPropOptions_Reload (table, "Methods", "%s!methods"%(self._prefix), methods, NOTE_METHODS) 
    38         self.AddPropEntry   (table, "Realm",   "%s!realm" %(self._prefix), NOTE_REALM) 
    39         self.AddPropEntry   (table, "Users",   "%s!users" %(self._prefix), NOTE_USERS) 
     38        self.AddPropEntry (table, "Realm", "%s!realm" %(self._prefix), NOTE_REALM) 
     39        self.AddPropEntry (table, "Users", "%s!users" %(self._prefix), NOTE_USERS) 
    4040 
    4141        txt += "<h2>Authentication Details</h2>" 
  • cherokee/trunk/admin/ModuleBalancer.py

    r2283 r2869  
    6666            txt += str(table) 
    6767 
     68        txt += '<br/>\n' 
    6869        txt += '<h2>Assign Information Sources</h2>' 
    6970        if not general_left: 
  • cherokee/trunk/admin/ModuleCgi.py

    r2799 r2869  
     1import validations  
     2 
    13from Table import * 
    24from ModuleHandler import * 
    3 from validations import * 
    45 
    56NOTE_SCRIPT_ALIAS  = 'Path to an executable that will be run with the CGI as parameter.' 
     
    910NOTE_PASS_REQ      = 'Forward all the client headers to the CGI encoded as HTTP_*. headers.' 
    1011NOTE_XSENDFILE     = 'Allow the use of the non-standard X-Sendfile header.' 
     12 
     13DATA_VALIDATION = [ 
     14    ('vserver!.+?!rule!.+?!handler!script_alias', validations.is_path), 
     15] 
    1116 
    1217HELPS = [ 
     
    9095            self._cfg['%s!check_file'%(self._prefix)] = self.fixed_check_file 
    9196 
    92         self.ApplyChangesPrefix (self._prefix, checkboxes, post
     97        self.ApplyChangesPrefix (self._prefix, checkboxes, post, DATA_VALIDATION
    9398 
    9499    def _util__set_fixed_check_file (self): 
  • cherokee/trunk/admin/ModuleCommon.py

    r2281 r2869  
    4949        self.ApplyCheckbox (post, '%s!allow_dirlist'%(self._prefix)) 
    5050 
     51        # Apply the changes 
     52        self._file._op_apply_changes (uri, post) 
     53        self._dirlist._op_apply_changes (uri, post) 
     54 
    5155        # Copy errors from the child modules 
    5256        self._copy_errors (self._file,    self) 
    5357        self._copy_errors (self._dirlist, self) 
    5458 
    55         # Apply the changes 
    56         self._file._op_apply_changes (uri, post) 
    57         self._dirlist._op_apply_changes (uri, post) 
    58  
    5959    def _copy_errors (self, _from, _to): 
    6060        for e in _from.errors: 
  • cherokee/trunk/admin/ModuleDirlist.py

    r2094 r2869  
    77from configured import * 
    88 
    9 DATA_VALIDATION = [ 
    10     ('^vserver!.+?!.+?!.+?!handler!icon_dir',     validations.is_path), 
    11     ('^vserver!.+?!.+?!.+?!handler!notice_files', validations.is_path_list), 
    12 ] 
    13  
    149DEFAULT_THEME = "default" 
    1510 
     
    1712NOTE_ICON_DIR     = "Web directory where the icon files are located. Default: <i>/icons</i>." 
    1813NOTE_NOTICE_FILES = "List of notice files to be inserted." 
     14 
     15DATA_VALIDATION = [ 
     16    ('vserver!.+?!rule!.+?!handler!icon_dir',     validations.is_path), 
     17    ('vserver!.+?!rule!.+?!handler!notice_files', validations.is_path_list), 
     18] 
    1919 
    2020HELPS = [ 
     
    4747        themes = self._get_theme_list() 
    4848        self.AddPropOptions_Reload (table, 'Theme', "%s!theme" % (self._prefix), themes, NOTE_THEME) 
    49         self.AddPropEntry   (table, 'Icons dir',    "%s!icon_dir" % (self._prefix), NOTE_ICON_DIR) 
    50         self.AddPropEntry   (table, 'Notice files', "%s!notice_files" % (self._prefix), NOTE_NOTICE_FILES) 
     49        self.AddPropEntry (table, 'Icons dir',    "%s!icon_dir" % (self._prefix), NOTE_ICON_DIR) 
     50        self.AddPropEntry (table, 'Notice files', "%s!notice_files" % (self._prefix), NOTE_NOTICE_FILES) 
    5151        txt += self.Indent(table) 
    5252 
  • cherokee/trunk/admin/ModuleHtdigest.py

    r1982 r2869  
    77 
    88DATA_VALIDATION = [ 
    9     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',  
    10      (validations.is_local_file_exists, 'cfg')) 
     9    ('vserver!.*?!rule!.*?!auth!passwdfile', (validations.is_local_file_exists, 'cfg')) 
    1110] 
    1211 
  • cherokee/trunk/admin/ModuleHtpasswd.py

    r1982 r2869  
    77 
    88DATA_VALIDATION = [ 
    9     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',  
    10      (validations.is_local_file_exists, 'cfg')) 
     9    ('vserver!.*?!rule!.*?!auth!passwdfile', (validations.is_local_file_exists, 'cfg')) 
    1110] 
    1211 
  • cherokee/trunk/admin/ModulePlain.py

    r1982 r2869  
    77 
    88DATA_VALIDATION = [ 
    9     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',  
    10      (validations.is_local_file_exists, 'cfg')) 
     9    ('vserver!.*?!rule!.*?!auth!passwdfile', (validations.is_local_file_exists, 'cfg')) 
    1110] 
    1211 
  • cherokee/trunk/admin/ModuleStreaming.py

    r2861 r2869  
     1import validations  
     2 
    13from Form import * 
    24from Table import * 
     
    810NOTE_RATE_FACTOR = 'Factor to increases the bandwidth limit. Default: 0.1' 
    911NOTE_RATE_BOOST  = 'Number of seconds to stream before setting the bandwidth limit. Default: 5.' 
     12 
     13DATA_VALIDATION = [ 
     14    ('vserver!.+?!rule!.+?!handler!rate_factor', validations.is_float), 
     15    ('vserver!.+?!rule!.+?!handler!rate_boost',  validations.is_number_gt_0), 
     16] 
    1017 
    1118HELPS = [ 
     
    4451 
    4552    def _op_apply_changes (self, uri, post): 
    46         self.ApplyChangesPrefix (self._prefix, ['rate'], post) 
    47  
    48         # Copy errors from the child modules 
    49         self._copy_errors (self._file,    self) 
     53        self.ApplyChangesPrefix (self._prefix, ['rate'], post, DATA_VALIDATION) 
    5054 
    5155        # Apply the changes 
    5256        self._file._op_apply_changes (uri, post) 
    5357 
     58        # Copy errors from the child modules 
     59        self._copy_errors (self._file, self) 
     60 
    5461    def _copy_errors (self, _from, _to): 
    5562        for e in _from.errors: 
  • cherokee/trunk/admin/PageAdvanced.py

    r2510 r2869  
    1515    ('server!listen_queue',           validations.is_positive_int), 
    1616    ('server!max_connection_reuse',   validations.is_positive_int), 
    17     ('server!log_flush_lapse',       validations.is_positive_int), 
     17    ('server!log_flush_lapse',        validations.is_positive_int), 
    1818    ('server!keepalive_max_requests', validations.is_positive_int), 
    1919    ("server!keepalive$",             validations.is_boolean), 
    2020    ("server!thread_number",          validations.is_positive_int), 
    21     ("server!iocache$",                validations.is_boolean), 
     21    ("server!nonces_cleanup_lapse",   validations.is_positive_int), 
     22    ("server!iocache$",               validations.is_boolean), 
    2223    ("server!iocache!max_size",       validations.is_positive_int), 
    2324    ("server!iocache!min_file_size",  validations.is_positive_int), 
  • cherokee/trunk/admin/PageEntry.py

    r2809 r2869  
    2222 
    2323DATA_VALIDATION = [ 
    24     ("vserver!.*?!rule!(\d+)!document_root", (validations.is_dev_null_or_local_dir_exists, 'cfg')), 
    25     ("vserver!.*?!rule!(\d+)!allow_from",     validations.is_ip_or_netmask_list), 
    26     ("vserver!.*?!rule!(\d+)!rate",           validations.is_number_gt_0) 
     24    ("vserver!.*?!rule!(\d+)!document_root",  (validations.is_dev_null_or_local_dir_exists, 'cfg')), 
     25    ("vserver!.*?!rule!(\d+)!allow_from",      validations.is_ip_or_netmask_list), 
     26    ("vserver!.*?!rule!(\d+)!rate",            validations.is_number_gt_0), 
     27    ("vserver!.*?!rule!(\d+)!expiration!time", validations.is_time)  
    2728] 
    2829 
  • cherokee/trunk/admin/PageMime.py

    r2792 r2869  
    99DATA_VALIDATION = [ 
    1010    ("mime!.*!extensions", validations.is_extension_list), 
    11     ("mime!.*!max\-age",   validations.is_number) 
     11    ("mime!.*!max\-age",   validations.is_number), 
     12    ("tmp!new_extensions", validations.is_extension_list), 
     13    ("tmp!new_maxage",     validations.is_number) 
    1214] 
    1315 
     
    5254 
    5355    def _add_new_mime (self, post): 
     56        # Validate entries 
     57        self._ValidateChanges (post, DATA_VALIDATION) 
     58        if self.has_errors(): 
     59            return 
     60         
    5461        mime = post.pop('tmp!new_mime') 
    5562        exts = post.pop('tmp!new_extensions') 
  • cherokee/trunk/admin/PageVServer.py

    r2862 r2869  
    1010 
    1111DATA_VALIDATION = [ 
     12    ("vserver!.*?!user_dir",                   validations.is_safe_id), 
    1213    ("vserver!.*?!document_root",             (validations.is_dev_null_or_local_dir_exists, 'cfg')), 
    1314    ("vserver!.*?!ssl_certificate_file",      (validations.is_local_file_exists, 'cfg', 'nochroot')), 
  • cherokee/trunk/admin/PageVServers.py

    r2830 r2869  
    99    ("new_vserver_name",   validations.is_safe_id), 
    1010    ("new_vserver_droot", (validations.is_dev_null_or_local_dir_exists, 'cfg')), 
     11    ("vserver_clone_trg",  validations.is_safe_id), 
    1112] 
    1213 
     
    233234 
    234235    def _op_clone_vserver (self, post): 
     236        # Validate entries 
     237        self._ValidateChanges (post, DATA_VALIDATION) 
     238        if self.has_errors(): 
     239            return 
     240 
    235241        # Fetch data 
    236242        prio_source = post.pop('vserver_clone_src') 
  • cherokee/trunk/admin/validations.py

    r2808 r2869  
    77    except: 
    88        raise ValueError, 'Malformed number' 
     9 
     10def is_float (value): 
     11    try: 
     12        return str(float(value)) 
     13    except: 
     14        raise ValueError, 'Malformed float number' 
    915 
    1016def is_number_gt_0 (value): 
     
    277283 
    278284    return value 
     285 
     286def is_time (value): 
     287    # The m, h, d and w suffixes are allowed for minutes, hours, days, 
     288    # and weeks. Eg: 2d. 
     289    for c in value: 
     290        if c not in ".0123456789mhdw": 
     291            raise ValueError, 'Time value contain invalid values' 
     292    for c in ".mhdw": 
     293        if value.count(c) > 1: 
     294            raise ValueError, 'Malformed time' 
     295     
     296    return value 
     297 
     298