Trees | Indices | Help |
|
---|
|
object --+ | WithAbsoluteUrlMixin
This class provides a common implementation for the ``absolute_url`` tales function. ``absolute_url`` is supposed to return an URL where one can retrieve a *description* of an object (this is *not* the URL where a package can be downloaded, nor the URI-ref of an element). It is intensively used in HTML views served by the embedded HTTP server in the Advene tool. ``absolute_url`` is expected to consume the rest of the TALES path, and suffix it to its return value. E.g:: some_element/absolute_url/content_data -> http://localhost:1234/packages/p/some_element/content_data some_package/absolute_url/annotations -> http://localhost:1234/packages/some_package/annotations But if no URL can be constructed, it returns None. This mixin provides all the bells and whistles to do so. It relies on the presence of two TALES variables: * options/packages (mandatory) contains a dict whose keys are package names, and whose values are package instances * options/base_url (optional) contains the reference URL The returned value will be of the form:: base_url/specific/rest/of/the/path where ``specific`` is computed by a method from the mixed-in class, of the form:: def _compute_absolute_url(self, packages) and this method should invoke `self._absolute_url_fail()` if it can not construct a URL (resulting in the TALES path failing to evaluate).
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
See class documentation.
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jul 8 16:00:04 2009 | http://epydoc.sourceforge.net |