Permalink
Browse files

Switched everything to long imports

  • Loading branch information...
1 parent 0be02fa commit 1fb8eb165a3817d3e34d541da66df06b93baa5cd @mitsuhiko mitsuhiko committed Jan 3, 2011
Showing with 151 additions and 95 deletions.
  1. +4 −2 docs/levels.rst
  2. +3 −3 docs/local.rst
  3. +4 −4 docs/quickstart.rst
  4. +2 −1 docs/request_data.rst
  5. +1 −1 docs/serving.rst
  6. +5 −3 docs/test.rst
  7. +7 −6 docs/tutorial.rst
  8. +1 −1 docs/unicode.rst
  9. +4 −4 docs/wrappers.rst
  10. +2 −1 examples/contrib/securecookie.py
  11. +3 −1 examples/cookieauth.py
  12. +1 −1 examples/coolmagic/helpers.py
  13. +3 −1 examples/coolmagic/utils.py
  14. +2 −1 examples/couchy/application.py
  15. +3 −1 examples/couchy/utils.py
  16. +1 −1 examples/couchy/views.py
  17. +3 −1 examples/cupoftee/application.py
  18. +1 −1 examples/cupoftee/pages.py
  19. +2 −1 examples/httpbasicauth.py
  20. +2 −1 examples/i18nurls/application.py
  21. +1 −1 examples/plnt/sync.py
  22. +4 −2 examples/plnt/utils.py
  23. +2 −1 examples/plnt/webapp.py
  24. +2 −1 examples/shorty/application.py
  25. +3 −1 examples/shorty/utils.py
  26. +1 −1 examples/shorty/views.py
  27. +2 −1 examples/simplewiki/application.py
  28. +4 −2 examples/simplewiki/utils.py
  29. +3 −1 examples/upload.py
  30. +1 −1 examples/webpylike/webpylike.py
  31. +4 −2 tests/contrib/test_fixers.py
  32. +2 −1 tests/contrib/test_securecookie.py
  33. +3 −1 tests/contrib/test_testtools.py
  34. +2 −1 tests/contrib/test_wrappers.py
  35. +2 −1 tests/multipart/collect.py
  36. +1 −1 tests/test_compat.py
  37. +3 −1 tests/test_exceptions.py
  38. +5 −2 tests/test_formparser.py
  39. +4 −3 tests/test_internal.py
  40. +1 −1 tests/test_local.py
  41. +1 −1 tests/test_routing.py
  42. +1 −1 tests/test_security.py
  43. +2 −1 tests/test_serving.py
  44. +1 −1 tests/test_templates.py
  45. +3 −3 tests/test_urls.py
  46. +2 −1 tests/test_wsgi.py
  47. +2 −1 werkzeug/contrib/fixers.py
  48. +1 −1 werkzeug/contrib/limiter.py
  49. +3 −1 werkzeug/contrib/lint.py
  50. +3 −2 werkzeug/contrib/securecookie.py
  51. +5 −2 werkzeug/contrib/sessions.py
  52. +2 −1 werkzeug/contrib/testtools.py
  53. +1 −1 werkzeug/contrib/wrappers.py
  54. +1 −1 werkzeug/datastructures.py
  55. +2 −1 werkzeug/exceptions.py
  56. +2 −2 werkzeug/local.py
  57. +2 −1 werkzeug/routing.py
  58. +1 −1 werkzeug/serving.py
  59. +1 −1 werkzeug/templates.py
  60. +2 −1 werkzeug/testapp.py
  61. +1 −1 werkzeug/utils.py
  62. +6 −5 werkzeug/wrappers.py
  63. +2 −2 werkzeug/wsgi.py
View
@@ -17,7 +17,8 @@ Example
This example implements a small `Hello World` application that greets the
user with the name entered::
- from werkzeug import Request, Response, escape
+ from werkzeug.utils import escape
+ from werkzeug.wrappers import Request, Response
@Request.application
def hello_world(request):
@@ -35,7 +36,8 @@ user with the name entered::
Alternatively the same application could be use without request and response
objects but by taking advantage of the parsing functions werkzeug provides::
- from werkzeug import parse_form_data, escape
+ from werkzeug.formparser import parse_form_data
+ from werkzeug.utils import escape
def hello_world(environ, start_response):
result = ['<title>Greeter</title>']
View
@@ -24,7 +24,7 @@ before, and hence data is left in the thread local object.
Here's a simple example of how one could use werkzeug.local::
- from werkzeug import Local, LocalManager
+ from werkzeug.local import Local, LocalManager
local = Local()
local_manager = LocalManager([local])
@@ -76,14 +76,14 @@ context.
.. sourcecode:: pycon
- >>> from werkzeug import LocalProxy
+ >>> from werkzeug.local import LocalProxy
>>> isinstance(request, LocalProxy)
True
You can also create proxy objects by hand:
.. sourcecode:: python
- from werkzeug import Local, LocalProxy
+ from werkzeug.local import Local, LocalProxy
local = Local()
request = LocalProxy(local, 'request')
View
@@ -25,7 +25,7 @@ The WSGI environment contains all the information the user request transmit
to the application. It is passed to the WSGI application but you can also
create a WSGI environ dict using the :func:`create_environ` helper:
->>> from werkzeug import create_environ
+>>> from werkzeug.test import create_environ
>>> environ = create_environ('/foo', 'http://localhost:8080/')
Now we have an environment to play around:
@@ -49,7 +49,7 @@ For access to the request data the :class:`Request` object is much more fun.
It wraps the `environ` and provides a read-only access to the data from
there:
->>> from werkzeug import Request
+>>> from werkzeug.wrappers import Request
>>> request = Request(environ)
Now you can access the important variables and Werkzeug will parse them
@@ -226,7 +226,7 @@ So imagine your standard WSGI "Hello World" application::
With request objects it would look like this::
- from werkzeug import Response
+ from werkzeug.wrappers import Response
def application(environ, start_response):
response = Response('Hello World!')
@@ -235,7 +235,7 @@ With request objects it would look like this::
Also unlike request objects response objects are designed to be modified.
So here is what you can do with them:
->>> from werkzeug import Response
+>>> from werkzeug.wrappers import Response
>>> response = Response("Hello World!")
>>> response.headers['content-type']
'text/plain; charset=utf-8'
View
@@ -102,7 +102,8 @@ url encoded data. Extending the parsing capabilities by subclassing
the :class:`BaseRequest` is simple. The following example implements
parsing for incoming JSON data::
- from werkzeug import Request, cached_property
+ from werkzeug.utils import cached_property
+ from werkzeug.wrappers import Request
from simplejson import loads
class JSONRequest(Request):
View
@@ -15,7 +15,7 @@ application using the builtin server::
#!/usr/bin/env python
# -*- coding: utf-8 -*-
- from werkzeug import run_simple
+ from werkzeug.serving import run_simple
from myproject import make_app
app = make_app(...)
View
@@ -33,7 +33,9 @@ wrapper returns a tuple. Because response objects have the same signature,
you can use them as response wrapper, ideally by subclassing them and hooking
in test functionality.
->>> from werkzeug import Client, BaseResponse, test_app
+>>> from werkzeug.test import Client
+>>> from werkzeug.testapp import test_app
+>>> from werkzeug.wrappers import BaseResponse
>>> c = Client(test_app, BaseResponse)
>>> resp = c.get('/')
>>> resp.status_code
@@ -67,7 +69,7 @@ and request objects.
The following example creates a WSGI environment with one uploaded file
and a form field:
->>> from werkzeug import EnvironBuilder
+>>> from werkzeug.test import EnvironBuilder
>>> from StringIO import StringIO
>>> builder = EnvironBuilder(method='POST', data={'foo': 'this is some text',
... 'file': (StringIO('my file contents'), 'test.txt')})
@@ -76,7 +78,7 @@ and a form field:
The resulting environment is a regular WSGI environment that can be used for
further processing:
->>> from werkzeug import Request
+>>> from werkzeug.wrappers import Request
>>> req = Request(env)
>>> req.form['foo']
u'this is some text'
View
@@ -83,7 +83,8 @@ Here the initial code for our ``shorty/application.py`` file which implements
the WSGI application::
from sqlalchemy import create_engine
- from werkzeug import Request, ClosingIterator
+ from werkzeug.wrappers import Request
+ from werkzeug.wsgi import ClosingIterator
from werkzeug.exceptions import HTTPException
from shorty.utils import session, metadata, local, local_manager, url_map
@@ -209,7 +210,7 @@ the following code goes into the ``shorty/utils.py`` file::
from sqlalchemy import MetaData
from sqlalchemy.orm import create_session, scoped_session
- from werkzeug import Local, LocalManager
+ from werkzeug.local import Local, LocalManager
from werkzeug.routing import Map, Rule
local = Local()
@@ -436,7 +437,7 @@ empty ``views.py`` file:
.. sourcecode:: python
- from werkzeug import redirect
+ from werkzeug.utils import redirect
from werkzeug.exceptions import NotFound
from shorty.utils import session, render_template, expose, validate_url, \
url_for
@@ -526,7 +527,7 @@ object, the other one validates a URL. So let's add those to ``utils.py``::
from os import path
from urlparse import urlparse
- from werkzeug import Response
+ from werkzeug.wrappers import Response
from jinja2 import Environment, FileSystemLoader
ALLOWED_SCHEMES = frozenset(['http', 'https', 'ftp', 'ftps'])
@@ -683,7 +684,7 @@ First of all you have to add a new import and calculate the path to the
static files::
from os import path
- from werkzeug import SharedDataMiddleware
+ from werkzeug.wsgi import SharedDataMiddleware
STATIC_PATH = path.join(path.dirname(__file__), 'static')
@@ -742,7 +743,7 @@ minutes to load.
So let's start by adding a `Pagination` class into our utils module::
- from werkzeug import cached_property
+ from werkzeug.utils import cached_property
class Pagination(object):
View
@@ -120,7 +120,7 @@ powered applications you can change the default encoding Werkzeug operates on
by subclassing these two classes. For example you can easily set the
application to utf-7 and strict error handling::
- from werkzeug import BaseRequest, BaseResponse
+ from werkzeug.wrappers import BaseRequest, BaseResponse
class Request(BaseRequest):
charset = 'utf-7'
View
@@ -21,13 +21,13 @@ request variables (form data, request headers etc.).
The :class:`Response` on the other hand is a standard WSGI application that
you can create. The simple hello world in Werkzeug looks like this::
- from werkzeug import Response
+ from werkzeug.wrappers import Response
application = Response('Hello World!')
To make it more useful you can replace it with a function and do some
processing::
- from werkzeug import Request, Response
+ from werkzeug.wrappers import Request, Response
def application(environ, start_response):
request = Request(environ)
@@ -37,7 +37,7 @@ processing::
Because this is a very common task the :class:`~Request` object provides
a helper for that. The above code can be rewritten like this::
- from werkzeug import Request, Response
+ from werkzeug.wrappers import Request, Response
@Request.application
def application(request):
@@ -139,7 +139,7 @@ mix those classes in to extend the functionality of the :class:`BaseRequest`
or :class:`BaseResponse` object. Here a small example for a request object
that parses accept headers::
- from werkzeug import BaseRequest, AcceptMixin
+ from werkzeug.wrappers import AcceptMixin, BaseRequest
class Request(BaseRequest, AcceptMixin):
pass
@@ -9,7 +9,8 @@
:license: BSD.
"""
from time import asctime
-from werkzeug import run_simple, BaseRequest, BaseResponse
+from werkzeug.serving import run_simple
+from werkzeug.wrappers import BaseRequest, BaseResponse
from werkzeug.contrib.securecookie import SecureCookie
SECRET_KEY = 'V\x8a$m\xda\xe9\xc3\x0f|f\x88\xbccj>\x8bI^3+'
View
@@ -10,7 +10,9 @@
:copyright: Copyright 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
-from werkzeug import Request, Response, cached_property, redirect, escape, run_simple
+from werkzeug.serving import run_simple
+from werkzeug.utils import cached_property, escape, redirect
+from werkzeug.wrappers import Request, Response
from werkzeug.contrib.securecookie import SecureCookie
@@ -10,7 +10,7 @@
"""
from coolmagic.utils import Response, TemplateResponse, ThreadedRequest, \
export, url_for, redirect
-from werkzeug import escape
+from werkzeug.utils import escape
#: a thread local proxy request object
@@ -13,7 +13,9 @@
"""
from os.path import dirname, join
from jinja import Environment, FileSystemLoader
-from werkzeug import BaseRequest, BaseResponse, Local, LocalManager, redirect
+from werkzeug.local import Local, LocalManager
+from werkzeug.utils import redirect
+from werkzeug.wrappers import BaseRequest, BaseResponse
local = Local()
@@ -1,7 +1,8 @@
from couchdb.client import Server
from couchy.utils import STATIC_PATH, local, local_manager, \
url_map
-from werkzeug import Request, SharedDataMiddleware, ClosingIterator
+from werkzeug.wrappers import Request
+from werkzeug.wsgi import ClosingIterator, SharedDataMiddleware
from werkzeug.exceptions import HTTPException, NotFound
from couchy import views
from couchy.models import URL
View
@@ -2,7 +2,9 @@
from urlparse import urlparse
from random import sample, randrange
from jinja import Environment, FileSystemLoader
-from werkzeug import Response, Local, LocalManager, cached_property
+from werkzeug.local import Local, LocalManager
+from werkzeug.utils import cached_property
+from werkzeug.wrappers import Response
from werkzeug.routing import Map, Rule
TEMPLATE_PATH = path.join(path.dirname(__file__), 'templates')
View
@@ -1,4 +1,4 @@
-from werkzeug import redirect
+from werkzeug.utils import redirect
from werkzeug.exceptions import NotFound
from couchy.utils import render_template, expose, \
validate_url, url_for, Pagination
@@ -13,7 +13,9 @@
from threading import Thread
from cupoftee.db import Database
from cupoftee.network import ServerBrowser
-from werkzeug import Request, Response, Template, SharedDataMiddleware
+from werkzeug.templates import Template
+from werkzeug.wrappers import Request, Response
+from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.routing import Map, Rule
@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for more details.
"""
import operator
-from werkzeug import redirect
+from werkzeug.utils import redirect
from werkzeug.exceptions import NotFound
from cupoftee.application import Page
from cupoftee.utils import unicodecmp
@@ -9,7 +9,8 @@
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
-from werkzeug import Request, Response, run_simple
+from werkzeug.serving import run_simple
+from werkzeug.wrappers import Request, Response
class Application(object):
@@ -1,5 +1,6 @@
from os import path
-from werkzeug import BaseRequest, BaseResponse, Template
+from werkzeug.templates import Template
+from werkzeug.wrappers import BaseRequest, BaseResponse
from werkzeug.routing import NotFound, RequestRedirect
from werkzeug.exceptions import HTTPException, NotFound
from i18nurls.urls import map
View
@@ -12,7 +12,7 @@
import feedparser
from time import time
from datetime import datetime
-from werkzeug import escape
+from werkzeug.utils import escape
from plnt.database import Blog, Entry, session
from plnt.utils import strip_tags, nl2p
View
@@ -11,8 +11,10 @@
import re
from os import path
from jinja2 import Environment, FileSystemLoader
-from werkzeug import Response, Local, LocalManager, url_encode, \
- url_quote, cached_property
+from werkzeug.local import Local, LocalManager
+from werkzeug.urls import url_encode, url_quote
+from werkzeug.utils import cached_property
+from werkzeug.wrappers import Response
from werkzeug.routing import Map, Rule
View
@@ -10,7 +10,8 @@
"""
from os import path
from sqlalchemy import create_engine
-from werkzeug import SharedDataMiddleware, ClosingIterator, Request
+from werkzeug.wrappers import Request
+from werkzeug.wsgi import ClosingIterator, SharedDataMiddleware
from werkzeug.exceptions import HTTPException, NotFound
from plnt.utils import local, local_manager, url_map, endpoints
from plnt.database import session, metadata
@@ -1,5 +1,6 @@
from sqlalchemy import create_engine
-from werkzeug import Request, SharedDataMiddleware, ClosingIterator
+from werkzeug.wrappers import Request
+from werkzeug.wsgi import ClosingIterator, SharedDataMiddleware
from werkzeug.exceptions import HTTPException, NotFound
from shorty.utils import STATIC_PATH, session, local, local_manager, \
metadata, url_map
View
@@ -2,7 +2,9 @@
from urlparse import urlparse
from random import sample, randrange
from jinja2 import Environment, FileSystemLoader
-from werkzeug import Response, Local, LocalManager, cached_property
+from werkzeug.local import Local, LocalManager
+from werkzeug.utils import cached_property
+from werkzeug.wrappers import Response
from werkzeug.routing import Map, Rule
from sqlalchemy import MetaData
from sqlalchemy.orm import create_session, scoped_session
View
@@ -1,4 +1,4 @@
-from werkzeug import redirect
+from werkzeug.utils import redirect
from werkzeug.exceptions import NotFound
from shorty.utils import session, Pagination, render_template, expose, \
validate_url, url_for
Oops, something went wrong.

0 comments on commit 1fb8eb1

Please sign in to comment.