1
############################################################
3
############################################################
5
def loadapp(uri, name=None, relative_to=None, global_conf=None):
7
Provided by ``paste.deploy.loadapp``.
9
Load the specified URI as a WSGI application (returning IWSGIApp).
10
The ``name`` can be in the URI (typically as ``#name``). If it is
11
and ``name`` is given, the keyword argument overrides the URI.
13
If the URI contains a relative filename, then ``relative_to`` is
14
used (if ``relative_to`` is not provided, then it is an error).
16
``global_conf`` is used to load the configuration (additions
17
override the values). ``global_conf`` is copied before modifying.
20
def loadfilter(uri, name=None, relative_to=None, global_conf=None):
22
Provided by ``paste.deploy.loadfilter``.
24
Like ``loadapp()``, except returns in IFilter object.
27
def loadserver(uri, name=None, relative_to=None, global_conf=None):
29
Provided by ``paste.deploy.loadserver``.
31
Like ``loadapp()``, except returns in IServer object.
34
############################################################
36
############################################################
38
class IPasteAppFactory:
41
This is the spec for the ``paste.app_factory``
45
def __call__(global_conf, **local_conf):
47
Returns a WSGI application (IWSGIAPP) given the global
48
configuration and the local configuration passed in as keyword
51
All keys are strings, but values in local_conf may not be
52
valid Python identifiers (if you use ``**kw`` you can still
53
capture these values).
56
class IPasteCompositFactory:
59
This is the spec for the ``paste.composit_factory``
62
This also produces WSGI applications, like ``paste.app_factory``,
63
but is given more access to the context in which it is loaded.
66
def __call__(loader, global_conf, **local_conf):
68
Like IPasteAppFactory this returns a WSGI application
69
(IWSGIApp). The ``loader`` value conforms to the ``ILoader``
70
interface, and can be used to load (contextually) more
74
class IPasteFilterFactory:
77
This is the spec for the ``paste.filter_factory``
81
def __call__(global_conf, **local_conf):
83
Returns a IFilter object.
86
class IPasteFilterAppFactory:
89
This is the spec for the ``paste.filter_app_factory``
93
def __call__(wsgi_app, global_conf, **local_conf):
95
Returns a WSGI application that wraps ``wsgi_app``.
97
Note that paste.deploy creates a wrapper for these
98
objects that implement the IFilter interface.
101
class IPasteServerFactory:
104
This is the spec for the ``paste.server_factory``
105
protocol/entry_point.
108
def __call__(global_conf, **local_conf):
110
Returns a IServer object.
113
class IPasteServerRunner:
116
This is the spec for the ``paste.server_runner``
117
protocol/entry_point.
120
def __call__(wsgi_app, global_conf, **local_conf):
122
Serves the given WSGI application. May serve once, many
123
times, forever; nothing about how the server works is
126
Note that paste.deploy creates a wrapper for these
127
objects that implement the IServer interface.
133
This is an object passed into ``IPasteCompositFactory``. It is
134
currently implemented in ``paste.deploy.loadwsgi`` by
135
``ConfigLoader`` and ``EggLoader``.
138
def get_app(name_or_uri, global_conf=None):
140
Return an IWSGIApp object. If the loader supports named
141
applications, then you can use a simple name; otherwise
142
you must use a full URI.
144
Any global configuration you pass in will be added; you should
145
generally pass through the global configuration you received.
148
def get_filter(name_or_uri, global_conf=None):
150
Return an IFilter object, like ``get_app``.
153
def get_server(name_or_uri, global_conf=None):
155
Return an IServer object, like ``get_app``.
158
############################################################
160
############################################################
165
This is an application that conforms to `PEP 333
166
<http://www.python.org/peps/pep-0333.html>`_: Python Web Server
167
Gateway Interface v1.0
170
def __call__(environ, start_response):
172
Calls ``start_response(status_code, header_list)`` and returns
173
an iterator for the body of the response.
179
A filter is a simple case of middleware, where an object
180
wraps a single WSGI application (IWSGIApp).
183
def __call__(wsgi_app):
185
Returns an IWSGIApp object, typically one that wraps the
186
``wsgi_app`` passed in.
192
A simple server interface.
195
def __call__(wsgi_app):
197
Serves the given WSGI application. May serve once, many
198
times, forever; nothing about how the server works is