Skip to content
Myr

Update views.py

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by max demian · committed by max demian · parent 2eef63a · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:flask/views.py+4 added-4 removed
87 unmodified lines
88 view.__module__ = cls.__module__89 for decorator in cls.decorators:90 view = decorator(view)9192 # we attach the view class to the view function for two reasons:92 # We attach the view class to the view function for two reasons:93 # first of all it allows us to easily figure out what class-based94 # view this thing came from, secondly it's also used for instantiating95 # the view class so you can actually replace it with something else96 # for testing purposes and debugging.
13 unmodified lines
110 methods = set(rv.methods or [])111 for key in d:112 if key in http_method_funcs:113 methods.add(key.upper())114 # if we have no method at all in there we don't want to114 # If we have no method at all in there we don't want to115 # add a method list. (This is for instance the case for116 # the baseclass or another subclass of a base method view117 # that does not introduce new methods).118 if methods:
21 unmodified lines
140 app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))141 """142 def dispatch_request(self, *args, **kwargs):143 meth = getattr(self, request.method.lower(), None)144 # if the request method is HEAD and we don't have a handler for it145 # retry with GET144 # If the request method is HEAD and we don't have a handler for it145 # retry with GET.146 if meth is None and request.method == 'HEAD':147 meth = getattr(self, 'get', None)148 assert meth is not None, 'Unimplemented method %r' % request.method149 return meth(*args, **kwargs)