-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support view instance for blueprint add_route method #424
support view instance for blueprint add_route method #424
Conversation
toughrogrammer
commented
Feb 14, 2017
- make blueprint add_route method support view instance
- update documentation that doesn't specify url_prefix parameter
- update documentation that doesn't specify url_prefix parameter
sanic/blueprints.py
Outdated
self.routes.append(route) | ||
# Handle HTTPMethodView differently | ||
if hasattr(handler, 'view_class'): | ||
methods = frozenset(HTTP_METHODS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should a view default to having all methods defined? Maybe this should just be frozenset({'GET'})
?
sanic/blueprints.py
Outdated
""" | ||
Creates a blueprint route from a function. | ||
:param handler: Function to handle uri request. | ||
:param handler: Function or class instance to handle uri request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be more explicit? For example "Function for handling uri requests. Accepts function, or class instance with a view_class
method."
- modify comment by r0fls
Thanks to your review. They are updated. |
@seemethere When the release version?Our project use it! |