| copyright: | 2008 Glashammer Developers |
|---|---|
| license: | MIT |
The Glashammer Application.
WSGI Application
This should usually be made using the make_app() function, which additionally wraps the application in threadlocal session cleaning code.
Add a setup callable to be called on startup by the application.
This method is used to add pluggable capability to the application. For example, plugin A can load plugin B by importing and adding its setup func like so:
>>> from a import setup_a
>>> app.add_setup(setup_a)
Or in a real example:
>>> from glashammer.bundles.auth import setup_auth
>>> app.add_setup(setup_auth)
Will initialize the auth bundle for the application.
Add a template global variable.
Add an instance or module which contains functions for a number of views.
‘endpoint_base` The base end point. ‘controller` A module or instance to search for views in.
This method allows you to add multiple views from a source. It is useful in situations where it is desirable to add many views at once for a certain endpoint’s base.
For example:
app.add_url('/foo', 'foo/index')
app.add_url('/foo/add', 'foo/add')
class Controller(object):
def index(self):
...
def add(self):
...
app.add_views_controller('foo', Controller())
Here, the endpoint’s base is ‘foo’. And the actual endpoints will be the attribute names concatenated with the endpoint_base.
Create an application instance.