Changeset 338 for cleverbox/trunk/cleverbox
- Timestamp:
- 05/03/08 09:55:04 (4 years ago)
- Files:
-
- 1 modified
-
cleverbox/trunk/cleverbox/model/project.py (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cleverbox/trunk/cleverbox/model/project.py
r267 r338 36 36 If "status" parameter has a value (either "enabled" or "disabled"), returned list is limited to project with this status. 37 37 """ 38 38 39 39 list_projects = [] 40 40 … … 72 72 if not exists(environment, client_name, project_name): 73 73 raise Exception, 'Client "%s" has no project "%s".' % (client_name, project_name) 74 74 75 75 try: 76 76 os.unlink(os.path.join(environment.get_path('projects-enabled'), '%s-%s' % (client_name, project_name))) … … 85 85 Enables project in environment. 86 86 """ 87 87 88 88 if not exists(environment, client_name, project_name): 89 89 raise Exception, 'Client "%s" has no project "%s"' % (client_name, project_name) 90 90 91 91 target = os.path.join(environment.get_path('projects-available'), 92 92 '%s-%s' % (client_name, project_name)) … … 104 104 Creates a new project for client in environment. 105 105 """ 106 106 107 107 # Merging for consistency 108 108 parameters['client'] = client_name … … 146 146 # -- Modifies Trac default conf 147 147 _trac_defaultconf(environment, parameters) 148 148 149 149 # -- Fix perms 150 150 _fix_perms(environment, parameters) … … 217 217 'trac_install_dir' : environment.config.get('trac', 'lib_dir')} 218 218 219 trac_cmd = ' /usr/bin/trac-admin %(env_path)s initenv %(title)s %(db_dsn)s svn %(svn_path)s %(templates_path)s' % cmd_data219 trac_cmd = 'trac-admin %(env_path)s initenv %(title)s %(db_dsn)s svn %(svn_path)s %(templates_path)s' % cmd_data 220 220 221 221 (stdin, stdout, stderr) = os.popen3( trac_cmd ) … … 239 239 perms_config = ConfigParser.SafeConfigParser() 240 240 perms_config.read(os.path.join(environment.path, 'profiles', infos['profile'], 'permissions.ini')) 241 241 242 242 # Grant permissions as defined in permissions.ini 243 243 for profile in perms_config.options('trac'): … … 253 253 'subject' : admin_login, 254 254 'perms' : 'TRAC_ADMIN'} ) 255 255 256 256 print " Trac initial permissions set (admin rights given to '%s')\n" % admin_login 257 257 258 258 def _trac_revoke_all_perms(environment, infos): 259 259 import trac.env 260 260 261 261 trac_env_path = os.path.join( environment.config.get('general', 'clients_root'), 262 262 infos['client'], 263 263 'var/trac', 264 264 infos['short_name'] ) 265 265 266 266 # Revoke all permissions 267 267 trac_env = trac.env.open_environment(trac_env_path) … … 270 270 db_cursor.execute('DELETE FROM permission') 271 271 trac_db.commit() 272 272 273 273 print " Revoked Trac default permissions\n" 274 274 … … 278 278 client_name = infos['client'] 279 279 project_name = infos['short_name'] 280 280 281 281 permissions = { 282 282 os.path.join(environment.get_path(), 'projects-available', client_name + '-' + project_name) : (0640, 'root', 'root'), … … 299 299 Overrides project's default trac.ini with values provided in configuration profile. 300 300 """ 301 301 302 302 # New defaults 303 303 tracdefaults_config = ConfigParser.SafeConfigParser() 304 304 tracdefaults_config.read(os.path.join(environment.path, 'profiles', infos['profile'], 'trac-defaults.ini')) 305 305 306 306 # Trac base config file 307 307 project_config_path = os.path.join(environment.config.get('general', 'clients_root'), infos['client'], 'var', 'trac', infos['short_name'], 'conf', 'trac.ini') … … 318 318 default_option = tracdefaults_config.get(section, option) 319 319 tracproject_config.set(section, option, default_option) 320 320 321 321 # Add cleverbox section 322 322 # The variables in this section can be used for string substitution across the file … … 326 326 'authbackend_pass' : environment.config.get('general', 'authbackend_pass'), 327 327 'trac_install_dir' : environment.config.get('trac', 'lib_dir'), 328 'domain_name' : environment.config.get('general', 'domain')} 328 'domain_name' : environment.config.get('general', 'domain')} 329 329 tracproject_config.add_section('cleverbox') 330 330 for (option, value) in cleverbox_options.items():
