rum.view

ViewFactory

class rum.view.ViewFactory

ViewFactory instances return initialized views when called.

All the magic is done in get() which is an abstract rum.genericfunctions.generic() function that subclasses extend to implement a pseudo-visitor pattern over objects and their attributes.

__call__(resource, parent=None, **kw)

Creates an instance of something for the given arguments. If the class that we shall instantiate (the one returned by get()) accepts a factory keyword argument the we will pass it a wekaref.proxy of ourselves so it can know who created and access resources with a long lifecycle (eg: database connections, etc...) common to all products. Arguments used to call the factory will also be tried to be passed to the product’s constructor.

get(resource, parent=None, remote_name=None, attr=None, action=None, args=None)

Return a class implementing rum.interfaces.IView. Depending on the action it should return a class implementing rum.interfaces.IInputView instead.

next_id()

Get a new unique id for the view

Example:

>>> f = ViewFactory()
>>> f.id_prefix in f.next_id()
True

Table Of Contents

Previous topic

rum.query

Next topic

rum.fields

This Page