Merge pull request #744 from ThomasWaldmann/sprint-branch
Before adoption: this commit came in with the history the project adopted, so no landing records it.
2 small fixes for metaclass and import usage
authored by Daniel Neuhäuser · committed by Daniel Neuhäuser · parents 3c5d7ba, 96b8ffb · Browse files · 7 files·+8 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+8 added−9 removed
- other:+8 added−9 removed
Provenance
- Commit
1fe20d3- Tree
2db1c29- Author
Daniel Neuhäuser <dasdasich@gmail.com>- Committer
Daniel Neuhäuser <dasdasich@gmail.com>- Parent 1
3c5d7ba- Parent 2
96b8ffb
7 files changed+8 added−9 removed
modified:flask/app.py+1 added-1 removed
32 unmodified lines33 from .templating import DispatchingJinjaLoader, Environment, \34 _default_template_ctx_processor35 from .signals import request_started, request_finished, got_request_exception, \36 request_tearing_down, appcontext_tearing_down37-from flask._compat import reraise, string_types, integer_types37+from ._compat import reraise, string_types, integer_types38 39 # a lock used for logger initialization40 _logger_lock = Lock()41 1774 unmodified linesmodified:flask/config.py+1 added-1 removed
12 unmodified lines13 import os14 import errno15 16 from werkzeug.utils import import_string17-from flask._compat import string_types17+from ._compat import string_types18 19 20 class ConfigAttribute(object):21 """Makes an attribute forward to the config"""147 unmodified linesmodified:flask/debughelpers.py+1 added-1 removed
6 unmodified lines7 8 :copyright: (c) 2011 by Armin Ronacher.9 :license: BSD, see LICENSE for more details.10 """11-from flask._compat import implements_to_string11+from ._compat import implements_to_string12 13 14 class UnexpectedUnicodeError(AssertionError, UnicodeError):15 """Raised in places where we want some better error reporting for72 unmodified linesmodified:flask/exthook.py+1 added-1 removed
19 unmodified lines20 :license: BSD, see LICENSE for more details.21 """22 import sys23 import os24-from flask._compat import reraise24+from ._compat import reraise25 26 27 class ExtensionImporter(object):28 """This importer redirects imports from this submodule to other locations.92 unmodified linesmodified:flask/helpers.py+1 added-1 removed
22 unmodified lines23 24 25 from werkzeug.datastructures import Headers26 from werkzeug.exceptions import NotFound27-from flask._compat import string_types, text_type27 28 # this was moved in 0.729 try:30 from werkzeug.wsgi import wrap_file4 unmodified lines35 36 from .signals import message_flashed37 from .globals import session, _request_ctx_stack, _app_ctx_stack, \38 current_app, request39+from ._compat import string_types, text_type40 41 42 # sentinel43 _missing = object()802 unmodified linesmodified:flask/testing.py+1 added-1 removed
11 unmodified lines12 13 from contextlib import contextmanager14 from werkzeug.test import Client, EnvironBuilder15 from flask import _request_ctx_stack16-from flask._compat import urlparse16+from ._compat import urlparse17 18 19 def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):20 """Creates a new test builder with some application defaults thrown in."""100 unmodified linesmodified:flask/views.py+2 added-3 removed
7 unmodified lines8 :copyright: (c) 2011 by Armin Ronacher.9 :license: BSD, see LICENSE for more details.10 """11 from .globals import request12+from ._compat import with_metaclass13 14 15 http_method_funcs = frozenset(['get', 'post', 'head', 'options',16 'delete', 'put', 'trace', 'patch'])102 unmodified lines119 rv.methods = sorted(methods)120 return rv121 122 122-class MethodView(View):123+class 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 automatically10 unmodified lines138 return 'OK'139 140 app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))141 """141- __metaclass__ = MethodViewType142-142 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 GET4 unmodified lines