Package aquarium :: Package urlscheme :: Module UrlSchemeAPI
[show private | hide private]
[frames | no frames]

Module aquarium.urlscheme.UrlSchemeAPI

Document the API for url scheme classes.

An url scheme class encapsulates information about how URL's work for a particular Web site. For instance, how does the desired screen get retrieved from an URL, and where is the images directory in relation to that URL? By using an url scheme class successfully, all URL's are be created dynamically, and changing to a new format will be easy. (On the other hand, it's not a good idea to be changing the format of your URL's often, since bookmarks, external links, and search engines will break.)

The following methods are required:

getRootUrl(self, secure=-1)

Figure out the URL for the root of this site.

secure:

 0 -> http://
 1 -> https://
-1 -> (the default) results in whatever is currently being used
static(self, file, secure=-1)

Return an URL for something relative to the root URL.

file
This is a file relative to the root URL.
secure
See getRootUrl.
img(self, img, secure=-1)

Return an URL to an image.

Return self.static("images/" + img, secure). Hence, img should be something like buttons/foo.jpg.

screen(self, screen, vars=None, secure=-1)

Return a dynamic URL for the given screen.

screen
This is the module name (i.e. use dots, not slashes) of the screen relative to the screen package.
vars
A dictionary of variables that you want appended to the URL in the query string. This is done by urllib.urlencode.
secure
See getRootUrl.
hiddenFormFields(self, screen, vars=None)

Return necessary hidden form fields.

screen
This is the module name (i.e. use dots, not slashes) of the screen relative to the screen package.
vars
A dictionary of key/value pairs that you want included as hidden variables on the form.

This is a wrapper around aquarium.widget.HiddenFormFields that adds any hidden form fields Aquarium needs to use such as: sid, screen, etc. You should probably use this method everytime you generate a form.

whichScreen(self)

Which screen does the user want to view?

Return the module name (i.e. use dots, not slashes) of the screen relative to the screen package.

Alternatively, advanced users may return a tuple (moduleName, screenArgs, screenKargs).


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