Package advene :: Package server :: Module webcherry :: Class Packages
[hide private]
[frames] | no frames]

Class Packages

source code

Common --+
         |
        Packages

Node for packages access.

Instance Methods [hide private]
 
index(self)
Display currently available (loaded) packages.
source code
 
display_package_element(self, p, tales, query=None)
Display a view for a TALES expression.
source code
 
default(self, *args, **query)
Access a specific package.
source code
    Inherited from Common
 
__init__(self, controller=None) source code
 
_cpOnError(self)
Error message handling.
source code
string
image_type(self, o)
Return the image type (mime) of the object.
source code
string
location_bar(self)
Returns a string representing the active location bar.
source code
 
no_cache(self)
Write the cache-control headers in the response.
source code
 
send_error(self, status=404, message=None)
Sends an error response.
source code
 
send_no_content(self)
Sends a No Content (204) response.
source code
 
send_redirect(self, location)
Sends a redirect response.
source code
 
start_html(self, title='', headers=None, head_section=None, body_attributes='', mode=None, mimetype=None, duplicate_title=False, cache=False)
Starts writing a HTML response (header + common body start).
source code
Method Details [hide private]

index(self)

source code 

Display currently available (loaded) packages.

This method displays the list of currently loaded packages. The generated list provides links for accessing, reloading, saving or removing the package.

display_package_element(self, p, tales, query=None)

source code 

Display a view for a TALES expression.

This method displays the view for the element defined by the expression tales wrt to package p, with facultative parameters in query. It handles the /packages folder.

The query can hold an optional parameter, named mode, which indicates a specific display mode for the resulting object. Valid modes are:

  • image : the object is an image, and we generate the correct headers.
  • raw : do not display the navigation interface, but only the object's view
  • content : return the content data of an object, with its specific mime-type
  • default : default mode, with navigation interface

The display mode has a default value at the server level, wich can be set through the /admin folder.

An autodetect feature will force the display mode to image if the object is an image (depending on the return value of image_type).

All other other parameters given on the URL path are kepts in the query dictionary, which is available in TALES expressions through the request/ root element.

Parameters:
  • p (advene.model.Package) - the package in which the expression should be evaluated
  • tales (string) - a TALES expression
  • query (dict) - options used in TAL/TALES processing

default(self, *args, **query)

source code 

Access a specific package.

URL handling

The URL is first split in components, and some parameters may modify the interpretation of the path.

The path parameter is used to interactively modifying the path (through a form).

Else, the path value will be appended to the current path of the URL, and the browser is redirected to this new location.

The view parameter is a shortcut for rapidly accessing an element view. Its value is in fact the URL displaying the correct view, and the browser is redirected.