Commit f42a122c authored by Marcel's avatar Marcel
Browse files

Add more types for casting in vispa.config, fix vispa.ini.

parent 878f1294
......@@ -13,10 +13,10 @@ forgot_text = A mail with further instructions will be sent to your mail account
use_forgot = False
# use base when running in subdirectory
#base: '/vispa'
#base: /vispa
# set dynamic part seperatly
#base.dynamic: '/vispa'
#base.static: 'http://localhost:8080/'
#base.dynamic: /vispa
#base.static: http://localhost:8080/
[websockets]
use_websockets = False
......@@ -58,10 +58,10 @@ registration.autoactive: True
registration.mail_hosts: []
registration.sendmail: False
registration.activation: "http://localhost/activate"
registration.forgot: "http://localhost/forgot"
registration.smpt_host: "localhost"
registration.activation: http://localhost/activate
registration.forgot: http://localhost/forgot
registration.smpt_host: localhost
#registration.smpt_port: 25
[extensions]
ignore: ['workspace']
ignore: ['workspace']
......@@ -19,22 +19,34 @@ class _ConfigParser(cp.SafeConfigParser):
def __call__(self, section, option, default=None):
if config.has_option(section, option):
value = config.get(section, option)
# try to cast boolean values
if isinstance(default, list):
print "list", default, value
# try to cast according to 'default'
if default is None:
return value
# string
if isinstance(default, str):
return str(value)
# list
elif isinstance(default, list):
if value.startswith('[') and value.endswith(']'):
if (len(value) > 2):
return value[1:-1].split(",")
if len(value) > 2:
return value[1:-1].split(',')
else:
return []
else:
return [value]
# tuple
elif isinstance(default, tuple):
if len(value):
return tuple(value.split(','))
else:
return ()
# boolean
elif isinstance(default, bool):
if value == "True":
return True
elif value == "False":
return False
# TODO: other types
# TODO: dict
else:
return value
else:
......
......@@ -160,6 +160,7 @@ class Server(object):
'tools.staticdir.dir': 'img',
}
}
app = cherrypy.tree.mount(platform.controller, vispa.url.base_dynamic, platform_config)
if os.path.isfile(cherrypy_conf):
app.merge(cherrypy_conf)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment