|
a/Allura/allura/app.py |
|
b/Allura/allura/app.py |
|
... |
|
... |
3 |
from cStringIO import StringIO
|
3 |
from cStringIO import StringIO
|
4 |
|
4 |
|
5 |
from tg import expose, redirect, flash
|
5 |
from tg import expose, redirect, flash
|
6 |
from tg.decorators import without_trailing_slash
|
6 |
from tg.decorators import without_trailing_slash
|
7 |
from pylons import request, app_globals as g, tmpl_context as c
|
7 |
from pylons import request, app_globals as g, tmpl_context as c
|
|
|
8 |
from paste.deploy.converters import asbool
|
8 |
from bson import ObjectId
|
9 |
from bson import ObjectId
|
9 |
|
10 |
|
10 |
from ming.orm import session, state
|
11 |
from ming.orm import session, state
|
11 |
from ming.utils import LazyProperty
|
12 |
from ming.utils import LazyProperty
|
12 |
|
13 |
|
|
... |
|
... |
19 |
|
20 |
|
20 |
log = logging.getLogger(__name__)
|
21 |
log = logging.getLogger(__name__)
|
21 |
|
22 |
|
22 |
class ConfigOption(object):
|
23 |
class ConfigOption(object):
|
23 |
|
24 |
|
24 |
def __init__(self, name, ming_type, default):
|
25 |
def __init__(self, name, ming_type, default, label=None):
|
25 |
self.name, self.ming_type, self._default = (
|
26 |
self.name, self.ming_type, self._default, self.label = (
|
26 |
name, ming_type, default)
|
27 |
name, ming_type, default, label or name)
|
27 |
|
28 |
|
28 |
@property
|
29 |
@property
|
29 |
def default(self):
|
30 |
def default(self):
|
30 |
if callable(self._default):
|
31 |
if callable(self._default):
|
31 |
return self._default()
|
32 |
return self._default()
|
|
... |
|
... |
381 |
if is_admin:
|
382 |
if is_admin:
|
382 |
flash('Cannot delete the admin tool, sorry....')
|
383 |
flash('Cannot delete the admin tool, sorry....')
|
383 |
redirect('.')
|
384 |
redirect('.')
|
384 |
c.project.uninstall_app(self.app.config.options.mount_point)
|
385 |
c.project.uninstall_app(self.app.config.options.mount_point)
|
385 |
redirect('..')
|
386 |
redirect('..')
|
386 |
for k,v in kw.iteritems():
|
387 |
for opt in self.app.config_options:
|
|
|
388 |
if opt in Application.config_options:
|
|
|
389 |
continue # skip base options (mount_point, mount_label, ordinal)
|
|
|
390 |
val = kw.get(opt.name, '')
|
|
|
391 |
if opt.ming_type == bool:
|
|
|
392 |
val = asbool(val or False)
|
|
|
393 |
elif opt.ming_type == int:
|
|
|
394 |
val = asint(val or 0)
|
387 |
self.app.config.options[k] = v
|
395 |
self.app.config.options[opt.name] = val
|
388 |
if is_admin:
|
396 |
if is_admin:
|
389 |
# possibly moving admin mount point
|
397 |
# possibly moving admin mount point
|
390 |
redirect('/'
|
398 |
redirect('/'
|
391 |
+ c.project._id
|
399 |
+ c.project._id
|
392 |
+ self.app.config.options.mount_point
|
400 |
+ self.app.config.options.mount_point
|