26
26
class ViewPlugin(BasePlugin):
27
27
"""Marker class for plugins that provide views.
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.
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')).
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
48
See ivle.dispatch.generate_publisher for the registry code.
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.
50
34
View plugins may also have a 'help' property, which should contain a dict
51
35
of dicts and help file names. This dict is then used to generate the
63
47
"""Marker class for plugins that provide public mode views.
65
49
Public view plugins can specify the same 'urls' property as normal view
66
plugins, but they are added to the public mode publisher instead.
50
plugins, but they are added to the public mode router instead.