Package aquarium :: Package screen :: Module Controller :: Class Controller
[show private | hide private]
[frames | no frames]

Class Controller

AquariumClass --+
                |
               Controller

Known Subclasses:
wizard_review

This is a mostly empty superclass for controllers.


Method Summary
  __call__(self, callNext, *args, **kargs)
Save a reference to self in ctx.
  clearAction(self)
Clear out all form parameters that would execute an action.
  executeAction(self)
Call a method of the form doFooAction.
  getAction(self)
Get the name of the action executeAction would call or None.
  getBookmark(self, vars, stripAction)
Returns a bookmarkable URL for the current screen.
  getName(self)
Get the name of this screen.
    Inherited from AquariumClass
  __init__(self, ctx)
Set a reference to ctx.

Method Details

__call__(self, callNext, *args, **kargs)
(Call operator)

Save a reference to self in ctx.

clearAction(self)

Clear out all form parameters that would execute an action.

executeAction(self)

Call a method of the form doFooAction.

If there is a form variable named action containing something like Foo, e.g.:

http://bar?action=Foo

or if there is a form variable named something like action:Foo (this syntax was stolen from Zope), e.g.:

<input type="submit" name="action:Foo" value="Submit" />

this method will call the doFooAction method. Since controllers must often do double duty (they change state as well as prepare for the view), this method makes it possible to put all the state changing code in methods of the form doFooAction, leaving the main __call__ method mostly free to handle the preparation for the view.

The __call__ method should call self.executeAction() when it is ready for the action to be called. Having the subclass call executeAction rather than letting the superclass do it permits the subclass to do initialization in __call__ before the action method is called.

I'll call clearAction right before executing the action. Otherwise, if the action forwards to another controller, the new controller may try to execute its own doFooAction, which probably isn't what you want.

getAction(self)

Get the name of the action executeAction would call or None.

This is not the method name.

getBookmark(self, vars=None, stripAction=True)

Returns a bookmarkable URL for the current screen.

Builds a URL that can be used to return to this location in the site. Tries to save everything in the querystring, however, by default it will strip any actions that could be picked up by executeAction.

You may override this method in your own controller if you need to change the default for stripAction or if you need to do something fancy to create the bookmark URL. This method should not assume that self.screen is still set to this controller.

vars
A dictionary of variables that you want appended to the URL in the query string. If you have variables of the same name in the bookmark URL, vars will take precedence.
stripAction
If True, attempts to remove all actions from the querystring that could potentially be executed by executeAction().

getName(self)

Get the name of this screen.


Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 http://epydoc.sf.net