Changeset 2869
- Timestamp:
- 18/02/09 23:48:29 (1 year ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/admin/ModuleAuth.py (modified) (2 diffs)
- cherokee/trunk/admin/ModuleBalancer.py (modified) (1 diff)
- cherokee/trunk/admin/ModuleCgi.py (modified) (3 diffs)
- cherokee/trunk/admin/ModuleCommon.py (modified) (1 diff)
- cherokee/trunk/admin/ModuleDirlist.py (modified) (3 diffs)
- cherokee/trunk/admin/ModuleHtdigest.py (modified) (1 diff)
- cherokee/trunk/admin/ModuleHtpasswd.py (modified) (1 diff)
- cherokee/trunk/admin/ModulePlain.py (modified) (1 diff)
- cherokee/trunk/admin/ModuleStreaming.py (modified) (3 diffs)
- cherokee/trunk/admin/PageAdvanced.py (modified) (1 diff)
- cherokee/trunk/admin/PageEntry.py (modified) (1 diff)
- cherokee/trunk/admin/PageMime.py (modified) (2 diffs)
- cherokee/trunk/admin/PageVServer.py (modified) (1 diff)
- cherokee/trunk/admin/PageVServers.py (modified) (2 diffs)
- cherokee/trunk/admin/validations.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r2868 r2869 1 2009-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 1 11 2009-02-17 Alvaro Lopez Ortega <alvaro@octality.com> 2 12 cherokee/trunk/admin/ModuleAuth.py
r2094 r2869 7 7 8 8 DATA_VALIDATION = [ 9 ('vserver!.*?! (directory|extensions|request)!.*?!auth!users', validations.is_safe_id_list)9 ('vserver!.*?!rule!.*?!auth!users', validations.is_safe_id_list) 10 10 ] 11 11 … … 36 36 table = TableProps() 37 37 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) 40 40 41 41 txt += "<h2>Authentication Details</h2>" cherokee/trunk/admin/ModuleBalancer.py
r2283 r2869 66 66 txt += str(table) 67 67 68 txt += '<br/>\n' 68 69 txt += '<h2>Assign Information Sources</h2>' 69 70 if not general_left: cherokee/trunk/admin/ModuleCgi.py
r2799 r2869 1 import validations 2 1 3 from Table import * 2 4 from ModuleHandler import * 3 from validations import *4 5 5 6 NOTE_SCRIPT_ALIAS = 'Path to an executable that will be run with the CGI as parameter.' … … 9 10 NOTE_PASS_REQ = 'Forward all the client headers to the CGI encoded as HTTP_*. headers.' 10 11 NOTE_XSENDFILE = 'Allow the use of the non-standard X-Sendfile header.' 12 13 DATA_VALIDATION = [ 14 ('vserver!.+?!rule!.+?!handler!script_alias', validations.is_path), 15 ] 11 16 12 17 HELPS = [ … … 90 95 self._cfg['%s!check_file'%(self._prefix)] = self.fixed_check_file 91 96 92 self.ApplyChangesPrefix (self._prefix, checkboxes, post )97 self.ApplyChangesPrefix (self._prefix, checkboxes, post, DATA_VALIDATION) 93 98 94 99 def _util__set_fixed_check_file (self): cherokee/trunk/admin/ModuleCommon.py
r2281 r2869 49 49 self.ApplyCheckbox (post, '%s!allow_dirlist'%(self._prefix)) 50 50 51 # Apply the changes 52 self._file._op_apply_changes (uri, post) 53 self._dirlist._op_apply_changes (uri, post) 54 51 55 # Copy errors from the child modules 52 56 self._copy_errors (self._file, self) 53 57 self._copy_errors (self._dirlist, self) 54 58 55 # Apply the changes56 self._file._op_apply_changes (uri, post)57 self._dirlist._op_apply_changes (uri, post)58 59 59 def _copy_errors (self, _from, _to): 60 60 for e in _from.errors: cherokee/trunk/admin/ModuleDirlist.py
r2094 r2869 7 7 from configured import * 8 8 9 DATA_VALIDATION = [10 ('^vserver!.+?!.+?!.+?!handler!icon_dir', validations.is_path),11 ('^vserver!.+?!.+?!.+?!handler!notice_files', validations.is_path_list),12 ]13 14 9 DEFAULT_THEME = "default" 15 10 … … 17 12 NOTE_ICON_DIR = "Web directory where the icon files are located. Default: <i>/icons</i>." 18 13 NOTE_NOTICE_FILES = "List of notice files to be inserted." 14 15 DATA_VALIDATION = [ 16 ('vserver!.+?!rule!.+?!handler!icon_dir', validations.is_path), 17 ('vserver!.+?!rule!.+?!handler!notice_files', validations.is_path_list), 18 ] 19 19 20 20 HELPS = [ … … 47 47 themes = self._get_theme_list() 48 48 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) 51 51 txt += self.Indent(table) 52 52 cherokee/trunk/admin/ModuleHtdigest.py
r1982 r2869 7 7 8 8 DATA_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')) 11 10 ] 12 11 cherokee/trunk/admin/ModuleHtpasswd.py
r1982 r2869 7 7 8 8 DATA_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')) 11 10 ] 12 11 cherokee/trunk/admin/ModulePlain.py
r1982 r2869 7 7 8 8 DATA_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')) 11 10 ] 12 11 cherokee/trunk/admin/ModuleStreaming.py
r2861 r2869 1 import validations 2 1 3 from Form import * 2 4 from Table import * … … 8 10 NOTE_RATE_FACTOR = 'Factor to increases the bandwidth limit. Default: 0.1' 9 11 NOTE_RATE_BOOST = 'Number of seconds to stream before setting the bandwidth limit. Default: 5.' 12 13 DATA_VALIDATION = [ 14 ('vserver!.+?!rule!.+?!handler!rate_factor', validations.is_float), 15 ('vserver!.+?!rule!.+?!handler!rate_boost', validations.is_number_gt_0), 16 ] 10 17 11 18 HELPS = [ … … 44 51 45 52 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) 50 54 51 55 # Apply the changes 52 56 self._file._op_apply_changes (uri, post) 53 57 58 # Copy errors from the child modules 59 self._copy_errors (self._file, self) 60 54 61 def _copy_errors (self, _from, _to): 55 62 for e in _from.errors: cherokee/trunk/admin/PageAdvanced.py
r2510 r2869 15 15 ('server!listen_queue', validations.is_positive_int), 16 16 ('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), 18 18 ('server!keepalive_max_requests', validations.is_positive_int), 19 19 ("server!keepalive$", validations.is_boolean), 20 20 ("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), 22 23 ("server!iocache!max_size", validations.is_positive_int), 23 24 ("server!iocache!min_file_size", validations.is_positive_int), cherokee/trunk/admin/PageEntry.py
r2809 r2869 22 22 23 23 DATA_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) 27 28 ] 28 29 cherokee/trunk/admin/PageMime.py
r2792 r2869 9 9 DATA_VALIDATION = [ 10 10 ("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) 12 14 ] 13 15 … … 52 54 53 55 def _add_new_mime (self, post): 56 # Validate entries 57 self._ValidateChanges (post, DATA_VALIDATION) 58 if self.has_errors(): 59 return 60 54 61 mime = post.pop('tmp!new_mime') 55 62 exts = post.pop('tmp!new_extensions') cherokee/trunk/admin/PageVServer.py
r2862 r2869 10 10 11 11 DATA_VALIDATION = [ 12 ("vserver!.*?!user_dir", validations.is_safe_id), 12 13 ("vserver!.*?!document_root", (validations.is_dev_null_or_local_dir_exists, 'cfg')), 13 14 ("vserver!.*?!ssl_certificate_file", (validations.is_local_file_exists, 'cfg', 'nochroot')), cherokee/trunk/admin/PageVServers.py
r2830 r2869 9 9 ("new_vserver_name", validations.is_safe_id), 10 10 ("new_vserver_droot", (validations.is_dev_null_or_local_dir_exists, 'cfg')), 11 ("vserver_clone_trg", validations.is_safe_id), 11 12 ] 12 13 … … 233 234 234 235 def _op_clone_vserver (self, post): 236 # Validate entries 237 self._ValidateChanges (post, DATA_VALIDATION) 238 if self.has_errors(): 239 return 240 235 241 # Fetch data 236 242 prio_source = post.pop('vserver_clone_src') cherokee/trunk/admin/validations.py
r2808 r2869 7 7 except: 8 8 raise ValueError, 'Malformed number' 9 10 def is_float (value): 11 try: 12 return str(float(value)) 13 except: 14 raise ValueError, 'Malformed float number' 9 15 10 16 def is_number_gt_0 (value): … … 277 283 278 284 return value 285 286 def 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