Update views.py
This commit is contained in:
parent
2eef63a320
commit
6974d52815
1 changed files with 4 additions and 4 deletions
|
|
@ -89,7 +89,7 @@ class View(object):
|
||||||
for decorator in cls.decorators:
|
for decorator in cls.decorators:
|
||||||
view = decorator(view)
|
view = decorator(view)
|
||||||
|
|
||||||
# we attach the view class to the view function for two reasons:
|
# We attach the view class to the view function for two reasons:
|
||||||
# first of all it allows us to easily figure out what class-based
|
# first of all it allows us to easily figure out what class-based
|
||||||
# view this thing came from, secondly it's also used for instantiating
|
# view this thing came from, secondly it's also used for instantiating
|
||||||
# the view class so you can actually replace it with something else
|
# the view class so you can actually replace it with something else
|
||||||
|
|
@ -111,7 +111,7 @@ class MethodViewType(type):
|
||||||
for key in d:
|
for key in d:
|
||||||
if key in http_method_funcs:
|
if key in http_method_funcs:
|
||||||
methods.add(key.upper())
|
methods.add(key.upper())
|
||||||
# if we have no method at all in there we don't want to
|
# If we have no method at all in there we don't want to
|
||||||
# add a method list. (This is for instance the case for
|
# add a method list. (This is for instance the case for
|
||||||
# the baseclass or another subclass of a base method view
|
# the baseclass or another subclass of a base method view
|
||||||
# that does not introduce new methods).
|
# that does not introduce new methods).
|
||||||
|
|
@ -141,8 +141,8 @@ class MethodView(with_metaclass(MethodViewType, View)):
|
||||||
"""
|
"""
|
||||||
def dispatch_request(self, *args, **kwargs):
|
def dispatch_request(self, *args, **kwargs):
|
||||||
meth = getattr(self, request.method.lower(), None)
|
meth = getattr(self, request.method.lower(), None)
|
||||||
# if the request method is HEAD and we don't have a handler for it
|
# If the request method is HEAD and we don't have a handler for it
|
||||||
# retry with GET
|
# retry with GET.
|
||||||
if meth is None and request.method == 'HEAD':
|
if meth is None and request.method == 'HEAD':
|
||||||
meth = getattr(self, 'get', None)
|
meth = getattr(self, 'get', None)
|
||||||
assert meth is not None, 'Unimplemented method %r' % request.method
|
assert meth is not None, 'Unimplemented method %r' % request.method
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue