|
a/Allura/allura/lib/plugin.py |
|
b/Allura/allura/lib/plugin.py |
|
... |
|
... |
221 |
become the project's superuser. If no user is specified, c.user is used.
|
221 |
become the project's superuser. If no user is specified, c.user is used.
|
222 |
'''
|
222 |
'''
|
223 |
from allura import model as M
|
223 |
from allura import model as M
|
224 |
assert h.re_path_portion.match(shortname.replace('/', '')), \
|
224 |
assert h.re_path_portion.match(shortname.replace('/', '')), \
|
225 |
'Invalid project shortname'
|
225 |
'Invalid project shortname'
|
|
|
226 |
try:
|
226 |
p = M.Project.query.get(shortname=shortname)
|
227 |
p = M.Project.query.get(shortname=shortname)
|
227 |
if p: raise forge_exc.ProjectConflict()
|
228 |
if p: raise forge_exc.ProjectConflict()
|
228 |
p = M.Project(neighborhood_id=neighborhood._id,
|
229 |
p = M.Project(neighborhood_id=neighborhood._id,
|
229 |
shortname=shortname,
|
230 |
shortname=shortname,
|
230 |
name=shortname,
|
231 |
name=shortname,
|
231 |
short_description='',
|
232 |
short_description='',
|
232 |
description=(shortname + '\n'
|
233 |
description=(shortname + '\n'
|
233 |
+ '=' * 80 + '\n\n'
|
234 |
+ '=' * 80 + '\n\n'
|
234 |
+ 'You can edit this description in the admin page'),
|
235 |
+ 'You can edit this description in the admin page'),
|
235 |
database_uri=config.get('ming.project.master'),
|
236 |
database_uri=M.Project.default_database_uri(shortname),
|
236 |
last_updated = datetime.utcnow(),
|
237 |
last_updated = datetime.utcnow(),
|
237 |
is_root=True)
|
238 |
is_root=True)
|
238 |
try:
|
|
|
239 |
p.configure_project(
|
239 |
p.configure_project(
|
240 |
users=[user],
|
240 |
users=[user],
|
241 |
is_user_project=user_project)
|
241 |
is_user_project=user_project)
|
|
|
242 |
except forge_exc.ProjectConflict:
|
|
|
243 |
raise
|
242 |
except:
|
244 |
except:
|
243 |
ThreadLocalORMSession.close_all()
|
245 |
ThreadLocalORMSession.close_all()
|
244 |
log.exception('Error registering project %s' % p)
|
246 |
log.exception('Error registering project %s' % p)
|
245 |
raise
|
247 |
raise
|
246 |
ThreadLocalORMSession.flush_all()
|
248 |
ThreadLocalORMSession.flush_all()
|