SaWALi Documentation

SaWALi Routes

SaWALi Routes

Description

This section details SaWALi's custom URIs— this is implemented through "config/routing.py". The routing script has also been modified so that it looks for the "sawali.siteroot" key in the configuration file. If the key has not been specified, "/" is used as the site root; otherwise, the sawali.siteroot value is prepended to all URIs, turning "/" into "/siteroot_value/".

URI-to-Application Routing

Default Route

This function is controlled by the default controller. It is invoked when the first item in PATH_INFO does not meet any of the below-mentioned first items (Cartero, CMS, DevTest, Feeder, Mapper, or UsersBase). It accepts two optional parameters: "{basename}" and "{docname}", which are used to select a given document from a specific documents database. On a successful selection, SaWALi responds with a Mako-rendered page; otherwise, a 404 Document Not Found error is returned.

The URI formats that this function recognises are:

Note that SaWALi-powered websites have Home database, and that all databases have a root document (doc.__id__ == 0).

Development Tester

SaWALi comes with a development tester controller (devtester), which can be accessed when "DevTest" is given as the first item in PATH_INFO. This functiona takes an optional "{action}" parameter that will invoke a public method of the DevtesterController class.

Documents Management

This function is accessed when "CMS" is the first item in PATH_INFO (as in "/CMS") and it is handled by the docsmanager controller. An optional "{action}" parameter to invoke a specific, public controller method may be given.

OpenID Authentication and User Management

Two controllers are responsible for this function: openidauth and usermanager, respectively. It is activated when the first item in the PATH_INFO is "UsersBase". If the second item in PATH_INFO is "users" (as in "/UsersBase/users"), the usermanager controller is used; otherwise, openidauth is used.

Both "/UsersBase" and "/UsersBase/users" paths take an optional "{action}" parameter to invoke a specific, public controller method.

Site Mapping and Feed Generation

Two controllers are responsible for this function: docsmapper and docsfeeder, respectively.

docsmapper is used when the first item in PATH_INFO is "Mapper". As of this writing, this sub-function accepts an optional "{action}" and it must have the value "html" (as in "/Mapper/html"). If the parameter is given, SaWALi responds with an HTML sitemap; otherwise, an XML sitemap is returned.

docsfeeder is used when the first item in PATH_INFO is "Feeder". This sub-function requires a "{basename}" to be given, the name of a valid site section, like "Home". If this requirement is met, SaWALi responds with an RSS feed; otherwise, a 404 Document Not Found status is returned.

Web-to-Email Messaging

This function is accessed when "Cartero" is the first item in PATH_INFO ("/Cartero") and it is handled by the contactwebform controller. Without any parameters, SaWALi responds with a page that contains the contact form.

"process" is typically given as a parameter when calling this function from an HTML form, using its action attribute (as in `action="/Cartero/process"`). If, as in this case, the "process" parameter is supplied, SaWALi will respond with either a success or an error page, depending on whether the email was sent to the designated address.