Add convenience function for core_office_url()
config
This commit is contained in:
parent
af1e38aa18
commit
ffd451a700
|
@ -47,3 +47,18 @@ class RattailCOREPOSExtension(ConfigExtension):
|
||||||
config.coretrans_engines = engines
|
config.coretrans_engines = engines
|
||||||
config.coretrans_engine = engines.get('default')
|
config.coretrans_engine = engines.get('default')
|
||||||
CoreTransSession.configure(bind=config.coretrans_engine)
|
CoreTransSession.configure(bind=config.coretrans_engine)
|
||||||
|
|
||||||
|
|
||||||
|
def core_office_url(config, require=False, **kwargs):
|
||||||
|
"""
|
||||||
|
Returns the base URL for the CORE Office web app. Note that this URL will
|
||||||
|
*not* have a trailing slash.
|
||||||
|
"""
|
||||||
|
args = ['corepos', 'office.url']
|
||||||
|
if require:
|
||||||
|
url = config.require(*args, **kwargs)
|
||||||
|
return url.rstrip('/')
|
||||||
|
else:
|
||||||
|
url = config.get(*args, **kwargs)
|
||||||
|
if url:
|
||||||
|
return url.rstrip('/')
|
||||||
|
|
Loading…
Reference in a new issue