Flask 1.0.2 does not allow a dot (.) in the view_func name, which we use

during generting the routes for the node.

References:
2f57a0b917
https://github.com/pallets/flask/issues/2790

Fixes #3360
Reported by: Marcelo Mendes
Investigated by: Khushboo Vashi
pull/14/head
Ashesh Vashi 2018-06-18 09:58:14 +05:30
parent 5f51c39e6f
commit f2cef38364
1 changed files with 3 additions and 2 deletions

View File

@ -266,6 +266,7 @@ class NodeView(with_metaclass(MethodViewType, View)):
commands = cls.generate_ops()
for c in commands:
cmd = c['cmd'].replace('.', '-')
if c['with_id']:
blueprint.add_url_rule(
'/{0}{1}'.format(
@ -273,7 +274,7 @@ class NodeView(with_metaclass(MethodViewType, View)):
),
view_func=cls.as_view(
'{0}{1}'.format(
c['cmd'], '_id' if c['req'] else ''
cmd, '_id' if c['req'] else ''
),
cmd=c['cmd']
),
@ -283,7 +284,7 @@ class NodeView(with_metaclass(MethodViewType, View)):
blueprint.add_url_rule(
'/{0}'.format(c['cmd']),
view_func=cls.as_view(
'{0}'.format(c['cmd']), cmd=c['cmd']
cmd, cmd=c['cmd']
),
methods=c['methods']
)