Changeset 1130
- Timestamp:
- 02/21/08 12:38:21 (7 months ago)
- Files:
-
- cherokee/trunk/admin/CherokeeManagement.py (modified) (2 diffs)
- cherokee/trunk/admin/ModuleFile.py (modified) (1 diff)
- cherokee/trunk/admin/config.py (modified) (1 diff)
- cherokee/trunk/admin/consts.py (modified) (1 diff)
- cherokee/trunk/admin/error_not_found.template.html (modified) (1 diff)
- cherokee/trunk/admin/error_not_writable.template.html (modified) (1 diff)
- cherokee/trunk/admin/server.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/admin/CherokeeManagement.py
r1096 r1130 5 5 import select 6 6 7 from consts import * 7 8 from configured import * 8 9 … … 110 111 pass 111 112 113 def create_config (self, file): 114 if os.path.exists (file): 115 return 116 117 f = open(file, 'w+') 118 f.write (CHEROKEE_MIN_DEFAULT_CONFIG) 119 f.close() 120 112 121 # Protected 113 122 # cherokee/trunk/admin/ModuleFile.py
r1116 r1130 14 14 def _op_render (self): 15 15 table = Table(2) 16 self.AddTableCheckbox (table, " I/O cache", "%s!io_cache" % (self._prefix), True)16 self.AddTableCheckbox (table, "Use I/O cache", "%s!io_cache" % (self._prefix), True) 17 17 return str(table) 18 18 cherokee/trunk/admin/config.py
r1079 r1130 223 223 # Checks 224 224 def is_writable (self): 225 try:226 open (self.file, "a") 227 except:225 import os 226 227 if not os.path.exists (self.file): 228 228 return False 229 return True229 return os.access (self.file, os.W_OK) 230 230 231 231 def has_tree (self): cherokee/trunk/admin/consts.py
r1115 r1130 58 58 ('gzip', 'GZip') 59 59 ] 60 61 62 63 CHEROKEE_MIN_DEFAULT_CONFIG = """# Default configuration 64 vserver!default!document_root = /tmp 65 vserver!default!directory!/!handler = common 66 vserver!default!directory!/!priority = 1 67 """ 68 cherokee/trunk/admin/error_not_found.template.html
r1045 r1130 1 1 <h1>ERROR</h1> 2 2 3 <p>Could not find the configuration file <b>%(cherokee_conf)s</b>.</p> 4 <p>You may need to reinstall the web server.</p> 3 <div class="dialog-error"> 4 <p>Could not find the configuration file <b>%(cherokee_conf)s</b>.</p> 5 </div> 6 7 <h2>Create a new configuration file</h2> 8 9 <div class="indented"> 10 <p>You can create a new configuration file and proceed to configure 11 the web server from scratch:</p> 12 13 <p style="text-align: center;"> 14 <a class="button" href="/create_config"> 15 <span>Create new configuration file</span> 16 </a> 17 </p> 18 </div> cherokee/trunk/admin/error_not_writable.template.html
r1045 r1130 1 1 <h1>ERROR</h1> 2 2 3 <p>The configuration file <b>%(cherokee_conf)s</b> cannot be modified.</p> 3 <div class="dialog-error"> 4 <p>The configuration file <b>%(cherokee_conf)s</b> cannot be modified.</p> 5 </div> 6 4 7 <p>You have to change its permissions in order to allow cherokee-admin to work with it.</p> 5 8 cherokee/trunk/admin/server.py
r1122 r1130 53 53 # Ensure that the configuration file is writable 54 54 if not cfg.has_tree(): 55 page = PageError (cfg, PageError.CONFIG_NOT_FOUND) 55 if not uri.startswith('/create_config'): 56 page = PageError (cfg, PageError.CONFIG_NOT_FOUND) 56 57 elif not cfg.is_writable(): 57 58 page = PageError (cfg, PageError.CONFIG_NOT_WRITABLE) … … 102 103 cherokee_management_reset() 103 104 body = "/" 105 elif uri.startswith('/create_config'): 106 manager = cherokee_management_get (cfg) 107 manager.create_config (cfg.file) 108 cherokee_management_reset() 109 cfg = Config (cfg.file) 110 body = "/" 104 111 elif uri.startswith('/ajax/update'): 105 112 page = PageAjaxUpdate (cfg) … … 112 119 self.handle_post() 113 120 post = Post (self.post) 114 121 115 122 # Execute page 116 123 if page: … … 125 132 self.wfile.write('Status: %s\r\n' % (status) + 126 133 headers + '\r\n' + body) 127 128 134 129 135