class Bottle(object):
Parameters | |
catchall | If true (default), handle all exceptions. Turn off to let debugging middleware handle exceptions. |
Method | add_hook |
Attach a callback to a hook. Three hooks are currently implemented: |
Method | add_route |
Add a route object, but do not change the Route.app attribute. |
Method | close |
Close the application and all installed plugins. |
Method | delete |
Equals route with a DELETE method parameter. |
Method | error |
Decorator: Register an output handler for a HTTP error code |
Method | get |
Equals route . |
Method | get_url |
Return a string that matches a named route |
Method | hook |
Return a decorator that attaches a callback to a hook. See add_hook for details. |
Method | install |
Add a plugin to the list of plugins and prepare it for being applied to all routes of this application. A plugin may be a simple decorator or an object that implements the Plugin API. |
Method | match |
Search for a matching route and return a (Route , urlargs) tuple. The second value is a dictionary with parameters extracted from the URL. Raise HTTPError (404/405) on a non-match. |
Method | merge |
No summary |
Method | mount |
Mount an application (Bottle or plain WSGI) to a specific URL prefix. Example: |
Method | post |
Equals route with a POST method parameter. |
Method | put |
Equals route with a PUT method parameter. |
Method | remove_hook |
Remove a callback from a hook. |
Method | reset |
Reset all routes (force plugins to be re-applied) and clear all caches. If an ID or route object is given, only that specific route is affected. |
Method | route |
A decorator to bind a function to a request URL. Example: |
Method | run |
Calls run with the same parameters. |
Method | trigger_hook |
Trigger a hook and return a list of results. |
Method | uninstall |
No summary |
Method | wsgi |
The bottle WSGI-interface. |
Class Variable | catchall |
Undocumented |
Instance Variable | config |
Undocumented |
Instance Variable | resources |
Undocumented |
Method | __call__ |
Each instance of 'Bottle' is a WSGI application. |
Method | __init__ |
Undocumented |
Method | _cast |
No summary |
Method | _handle |
Undocumented |
Method | default_error_handler |
Undocumented |
Class Variable | __hook_names |
Undocumented |
Class Variable | __hook_reversed |
Undocumented |
Instance Variable | error_handler |
Undocumented |
Instance Variable | plugins |
Undocumented |
Instance Variable | router |
Undocumented |
Instance Variable | routes |
Undocumented |
Instance Variable | stopped |
Undocumented |
Property | _hooks |
Undocumented |
Attach a callback to a hook. Three hooks are currently implemented:
Bottle.reset
is called.route
with a DELETE method parameter.add_hook
for details.Plugin
API.Mount an application (Bottle
or plain WSGI) to a specific
URL prefix. Example:
root_app.mount('/admin/', admin_app)
All other parameters are passed to the underlying route
call.
Parameters | |
prefix | path prefix or mount-point . If it ends in a slash,
that slash is mandatory. |
app | an instance of Bottle or a WSGI application. |
**options | Undocumented |
A decorator to bind a function to a request URL. Example:
@app.route('/hello/:name') def hello(name): return 'Hello %s' % name
The :name part is a wildcard. See Router
for syntax
details.
Any additional keyword arguments are stored as route-specific
configuration and passed to plugins (see Plugin.apply
).
Parameters | |
path | Request path or a list of paths to listen to. If no path is specified, it is automatically generated from the signature of the function. |
method | HTTP method (GET , POST , PUT , ...) or a list of
methods to listen to. (default: GET ) |
callback | An optional shortcut to avoid the decorator syntax. route(..., callback=func) equals route(...)(func) |
name | The name for this route. (default: None) |
apply | A decorator or plugin or a list of plugins. These are applied to the route callback in addition to installed plugins. |
skip | A list of plugins, plugin classes or names. Matching plugins are not installed to this route. True skips all. |
**config | Undocumented |