Skip to content

Commit

Permalink
Restore compatibility with tornado 2.0
Browse files Browse the repository at this point in the history
Thanks to github user hrawulwa for the report.
  • Loading branch information
rjuju committed Mar 23, 2021
1 parent e53ea1a commit a54fdc5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
4.1.2(WIP):
Bug fixes:
- Restore compatibility with tornado 2.0, thanks to github user hrawulwa for
the report.
4.1.1:
New features:
- Use locally available info for remote server configuration page when
Expand Down
18 changes: 12 additions & 6 deletions powa/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,21 @@ def parse_options():
print(SAMPLE_CONFIG_FILE)
sys.exit(-1)

if options['url_prefix'] == '':
options['url_prefix'] = "/"
elif options['url_prefix'] != '/':
options['url_prefix'] = "/" + options['url_prefix'].strip("/") + "/"
define("index_url", type=str, default="%sserver/" % options['url_prefix'])
if getattr(options, 'url_prefix', '') == '':
setattr(options, 'url_prefix', "/")
elif getattr(options, 'url_prefix', "/") != "/":
prefix = getattr(options, 'url_prefix', "/")
if (prefix[0] != "/"):
prefix = "/" + prefix
if (prefix[-1] != '/'):
prefix = prefix + "/"
setattr(options, 'url_prefix', prefix)
define("index_url", type=str,
default="%sserver/" % getattr(options, 'url_prefix', "/"))

# we expect a field named "username", but many people expect to be able to
# use "user" instead, so accept "user" as en alias for "username"
for key, conf in options['servers'].items():
for key, conf in getattr(options, 'servers', {}).items():
if 'user' in conf.keys():
conf['username'] = conf['user']
del conf['user']

0 comments on commit a54fdc5

Please sign in to comment.