Skip to content
Myr

fix metaclass usage for py3

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

authored by Thomas Waldmann · committed by Thomas Waldmann · parent af5576a · Browse files · 1 file+2 added−3 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+2 added−3 removed

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:flask/views.py+2 added-3 removed
7 unmodified lines
8 :copyright: (c) 2011 by Armin Ronacher.9 :license: BSD, see LICENSE for more details.10"""11from .globals import request12from ._compat import with_metaclass131415http_method_funcs = frozenset(['get', 'post', 'head', 'options',16 'delete', 'put', 'trace', 'patch'])
102 unmodified lines
119 rv.methods = sorted(methods)120 return rv121122122class MethodView(View):123class MethodView(with_metaclass(MethodViewType, View)):124 """Like a regular class-based view but that dispatches requests to125 particular methods. For instance if you implement a method called126 :meth:`get` it means you will response to ``'GET'`` requests and127 the :meth:`dispatch_request` implementation will automatically
10 unmodified lines
138 return 'OK'139140 app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))141 """141 __metaclass__ = MethodViewType142142 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 GET
4 unmodified lines