~ivle-dev/ivle/ui-the-third

« back to all changes in this revision

Viewing changes to ivle/webapp/base/plugins.py

  • Committer: William Grant
  • Date: 2009-08-20 05:02:19 UTC
  • Revision ID: grantw@unimelb.edu.au-20090820050219-i4p141o9xc4t1elw
Fix up the ViewPlugin docstring; it's all different now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
class ViewPlugin(BasePlugin):
27
27
    """Marker class for plugins that provide views.
28
28
 
29
 
    View plugins must have a 'urls' property which contains an iterable of pairs
30
 
    or triples, like (routex string, handler class, kwargs dict). The kwargs
31
 
    dict is optional. If present, the members of the kwargs dict will be passed
32
 
    as keyword arguments to the constructor of the view object.
 
29
    View plugins have three main types of registration:
 
30
     - forward_routes: A list of traversals from objects to their
 
31
       descendants. The discriminator is the source class and a list of zero
 
32
       or more intermediate path segments. An optional argument count may be
 
33
       given -- arguments will be taken from the path after the intermediate
 
34
       segments. The specified callable will be given the source object and
 
35
       any arguments, and should return the target object.
 
36
 
 
37
     - reverse_routes: A list of traversals from objects to their parents.
 
38
       The discriminator is just the child class. The provided callable must
 
39
       return a tuple of (parent_object, ('intermediate', path', 'segments')).
 
40
 
 
41
     - views: A list of named views for objects. The discriminator is the
 
42
       context object class, view name, and an optional view set. An optional
 
43
       (possibly infinite) argument count may again be given. The arguments
 
44
       values will be taken from the path after the view name. The callable
 
45
       should take the request object, target object and subpath, and return
 
46
       a view object.
 
47
 
 
48
    See ivle.dispatch.generate_publisher for the registry code.
33
49
 
34
50
    View plugins may also have a 'help' property, which should contain a dict
35
51
    of dicts and help file names. This dict is then used to generate the