Package nevow :: Module rend :: Class ConfigurableFactory
[show private | hide private]
[frames | no frames]

Class ConfigurableFactory

Known Subclasses:
Page

Locates configurables by looking for methods that start with configurable_ and end with the name of the configurable. The method should take a single arg (other than self) - the current context.
Method Summary
  configurable_(self, context)
Configurable factory for use when self is a configurable; aka it implements IConfigurable or one or more TypedInterface subclasses.
  configurable_original(self, ctx)
Configurable factory for use when self.original is a configurable; aka it implements IConfigurable or one or more TypedInterface subclasses.
  locateConfigurable(self, context, name)
formless.webform.renderForms calls locateConfigurable on the IConfigurableFactory instance it retrieves from the context.

Class Variable Summary
Implements __implemented__ = <implementedBy nevow.rend.Configurable...
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...

Method Details

configurable_(self, context)

Configurable factory for use when self is a configurable; aka it implements IConfigurable or one or more TypedInterface subclasses. Usage:
>>> class IFoo(TypedInterface):
...     def bar(): pass
...     bar = autocallable(bar)
...
>>> class Foo(Page):
...     implements(IFoo)
...
...     def bar():
...         print "bar called through the web!"
...
...     def render_forms(self, ctx, data):
...         return renderForms() # or renderForms('')
...
...     docFactory = stan(render_forms).

configurable_original(self, ctx)

Configurable factory for use when self.original is a configurable; aka it implements IConfigurable or one or more TypedInterface subclasses. Usage:
>>> class Foo(Page):
...     def __init__(self):
...         self.original = SomeConfigurable()
...     def render_forms(self, ctx, data):
...         return renderForms('original')
...     docFactory = stan(render_forms)

locateConfigurable(self, context, name)

formless.webform.renderForms calls locateConfigurable on the IConfigurableFactory instance it retrieves from the context. It passes the "name" that was passed to it, so if renderForms() was placed in the DOM, locateConfigurable will be called with name = ''; if renderForms('foo') was placed in the DOM, locateConfigurable will be called with name = 'foo'.

This default implementation of locateConfigurable looks for a configurable_* method corresponding to the name which was passed.

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy nevow.rend.ConfigurableFactory>                         

__providedBy__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0x40a88c6c>       

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0x40a88c6c>       

Generated by Epydoc 2.1 on Sun Oct 1 10:49:46 2006 http://epydoc.sf.net