Browse Source

Merge pull request #744 from ThomasWaldmann/sprint-branch

2 small fixes for metaclass and import usage
pull/745/merge
Daniel Neuhäuser 12 years ago
parent
commit
1fe20d3208
  1. 2
      flask/app.py
  2. 2
      flask/config.py
  3. 2
      flask/debughelpers.py
  4. 2
      flask/exthook.py
  5. 2
      flask/helpers.py
  6. 2
      flask/testing.py
  7. 5
      flask/views.py

2
flask/app.py

@ -34,7 +34,7 @@ from .templating import DispatchingJinjaLoader, Environment, \
_default_template_ctx_processor
from .signals import request_started, request_finished, got_request_exception, \
request_tearing_down, appcontext_tearing_down
from flask._compat import reraise, string_types, integer_types
from ._compat import reraise, string_types, integer_types
# a lock used for logger initialization
_logger_lock = Lock()

2
flask/config.py

@ -14,7 +14,7 @@ import os
import errno
from werkzeug.utils import import_string
from flask._compat import string_types
from ._compat import string_types
class ConfigAttribute(object):

2
flask/debughelpers.py

@ -8,7 +8,7 @@
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from flask._compat import implements_to_string
from ._compat import implements_to_string
class UnexpectedUnicodeError(AssertionError, UnicodeError):

2
flask/exthook.py

@ -21,7 +21,7 @@
"""
import sys
import os
from flask._compat import reraise
from ._compat import reraise
class ExtensionImporter(object):

2
flask/helpers.py

@ -24,7 +24,6 @@ from functools import update_wrapper
from werkzeug.datastructures import Headers
from werkzeug.exceptions import NotFound
from flask._compat import string_types, text_type
# this was moved in 0.7
try:
@ -37,6 +36,7 @@ from jinja2 import FileSystemLoader
from .signals import message_flashed
from .globals import session, _request_ctx_stack, _app_ctx_stack, \
current_app, request
from ._compat import string_types, text_type
# sentinel

2
flask/testing.py

@ -13,7 +13,7 @@
from contextlib import contextmanager
from werkzeug.test import Client, EnvironBuilder
from flask import _request_ctx_stack
from flask._compat import urlparse
from ._compat import urlparse
def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):

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