Skip to content

Commit 83f7658

Browse files
fix metaclass usage for py3
1 parent af5576a commit 83f7658

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

flask/views.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
:license: BSD, see LICENSE for more details.
1010
"""
1111
from .globals import request
12+
from ._compat import with_metaclass
1213

1314

1415
http_method_funcs = frozenset(['get', 'post', 'head', 'options',
@@ -119,7 +120,7 @@ def __new__(cls, name, bases, d):
119120
return rv
120121

121122

122-
class MethodView(View):
123+
class MethodView(with_metaclass(MethodViewType, View)):
123124
"""Like a regular class-based view but that dispatches requests to
124125
particular methods. For instance if you implement a method called
125126
:meth:`get` it means you will response to ``'GET'`` requests and
@@ -138,8 +139,6 @@ def post(self):
138139
139140
app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))
140141
"""
141-
__metaclass__ = MethodViewType
142-
143142
def dispatch_request(self, *args, **kwargs):
144143
meth = getattr(self, request.method.lower(), None)
145144
# if the request method is HEAD and we don't have a handler for it

0 commit comments

Comments
 (0)