Open jamielennox opened 5 years ago
File "/Users/jamielennox/.local/share/virtualenvs/presentation-CXDwjwgb/lib/python3.7/site-packages/flask_restplus/namespace.py", line 92, in wrapper
self.add_resource(cls, *urls, **kwargs)
File "/Users/jamielennox/.local/share/virtualenvs/presentation-CXDwjwgb/lib/python3.7/site-packages/flask_restplus/namespace.py", line 82, in add_resource
api.register_resource(self, resource, *ns_urls, **kwargs)
File "/Users/jamielennox/.local/share/virtualenvs/presentation-CXDwjwgb/lib/python3.7/site-packages/flask_restplus/api.py", line 266, in register_resource
self._register_view(self.app, resource, namespace, *urls, **kwargs)
File "/Users/jamielennox/.local/share/virtualenvs/presentation-CXDwjwgb/lib/python3.7/site-packages/flask_restplus/api.py", line 316, in _register_view
app.add_url_rule(rule, view_func=resource_func, **kwargs)
File "/Users/jamielennox/.local/share/virtualenvs/presentation-CXDwjwgb/lib/python3.7/site-packages/flask/blueprints.py", line 207, in add_url_rule
assert '.' not in view_func.__name__, "Blueprint view function name should not contain dots"
AssertionError: Blueprint view function name should not contain dots
Change was made in 1.0: https://github.com/pallets/flask/pull/2450
I have a Namespace defined with:
and i'm trying to register the API with a blueprint like:
When restplus registers the resource it has to give it an endpoint name that it calculates like: https://github.com/noirbizarre/flask-restplus/blob/a8f35823fe40b2c7385632a2ad6b35b26467402c/flask_restplus/api.py#L388-L390 which has the period in the endpoint name. Because a
.
is a special character in Flask blueprints this fails, where it works just fine when not using a blueprint. I don't thinkresource.__name__
would ever have a.
.We should simply replace the
.
with an_
or something that is valid.