Browse Source

fix metaclass usage for py3

pull/744/head
Thomas Waldmann 11 years ago
parent
commit
83f7658572
  1. 5
      flask/views.py

5
flask/views.py

@ -9,6 +9,7 @@
:license: BSD, see LICENSE for more details.
"""
from .globals import request
from ._compat import with_metaclass
http_method_funcs = frozenset(['get', 'post', 'head', 'options',
@ -119,7 +120,7 @@ class MethodViewType(type):
return rv
class MethodView(View):
class MethodView(with_metaclass(MethodViewType, View)):
"""Like a regular class-based view but that dispatches requests to
particular methods. For instance if you implement a method called
:meth:`get` it means you will response to ``'GET'`` requests and
@ -138,8 +139,6 @@ class MethodView(View):
app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))
"""
__metaclass__ = MethodViewType
def dispatch_request(self, *args, **kwargs):
meth = getattr(self, request.method.lower(), None)
# if the request method is HEAD and we don't have a handler for it

Loading…
Cancel
Save