Latest Version: 0.9.6.2

Warning

This documentation does not refer to the most recent version of Pylons. Current Documentation

Controller

Standard Pylons Controller for Web Requests

The Pylons Controller handles incoming web requests that are dispatched from the custom Myghty Routes resolver. These requests result in a new instance of the Controller being created, which is then called with the dict options from the Routes match.

By default, the Controller will search and attempt to call a __before__ method before calling the action, and will try to call a __after__ method after the action was called. These two methods can act as filters controlling access to the action, setup variables/objects for use with a set of actions, etc.

Each action to be called is inspected with _inspect_call so that it is only passed the arguments in the Routes match dict that it asks for. The only exception to the dict is that the Myghty ARGS variable is included.

In the event that an action is not found to handle the request, the Controller will raise an "Action Not Found" error if in debug mode, otherwise a 404 Not Found error will be returned.


Attributes

a __pudge_all__

['_inspect_call', '__call__', '_attach_locals']

Methods

f __init__(...) ...

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

f _attach_locals(self) ...

Attach Pylons special objects to the controller

When debugging, the Pylons special objects are unavailable because they are thread locals. This function pulls the actual object and attaches it to the controller so that it can be examined for debugging purposes.

f _inspect_call(self, func) ...

Calls a function with the names in kargs

Given a function, inspect_call will inspect the function args and call it with no further keyword args than it asked for.

If the function has been decorated, the decorator should have ensured that the original function is available at _orig for introspection.

f __call__(self, action) ...

Makes our controller a callable to handle requests

This is called when dispatched to as the Controller class docs explain more fully.

See the source for more information.

Top