Composed form support for zeam.form
This package let you defines forms containing other forms in zeam.form.base.
Here a simple example. Let’s define a setting form:
from zeam.form import composed, base from zope.interface import Interface class Setting(composed.ComposedForm): composed.context(Interface) label = u"Settings"
After, a module can add some mail settings on that screen:
class MailSetting(composed.SubForm): composed.context(MyApplication) composed.view(Setting) composed.order(99) label = u"Mail delivery settings" ...
And publications of that application could add some publication settings:
class PublicationSetting(composed.SubForm): composed.context(MyPublications) composed.view(Setting) composed.order(10) label = u"Publication settings" ...
Some default templates are included as well, but you can replace like you will do in zeam.form.base.
- This class define a form which able to contain other forms. It behave like a zeam.form.base Form, but does use its fields. A usefull method can give you back a given subform : getSubForm(identifier).
This class represent a form which is contained inside a ComposedForm. This form behave exactly like a zeam.form.base Form to which you add:
- a method available() which is called before anything else to know if the form shoud still be included in the ComposedForm.
- a method getComposedForm() that gives you back the composed form in which this form is rendered.
- This class let you group SubForm together. They are rendered within the group template, and prefixed by the group name. Like a SubForm they have an available() and a getComposedForm() method. It as well have a getSubForm(identifier) method.
All those directives comes from Grokcore component. Please refer to the Grok documentation for more information.
- Define for which object the form/sub form is available.
- Define the skin for which the form/sub form is aviable.
- Define a permission need to access the form.
- Define a Grok-like template for the form. After you done that, the Grok template will be look up and used. You can’t use anymore a megrok.pagetemplate template, unless you set template=None again on your form class.
- On a sub form, define for which form the sub form is available.
- Let you specify a number to sort your sub form afterwards using that setting.
- Update to use the latest grokcore.component.
- Now use grokcore.chameleon instead of megrok.chameleon.
- Fix various stupid bugs.
- Fix available issue after executing actions.
- Properly support zeam.form.base 1.2 (actions return the sub form on which the action have been executed).
- Updates tests.
- Add the concept of groups : subforms in a composed one can be grouped with them : they act as a composed form to the subform, and a subform to the composed form.
- Update default templates to reflect changes in zeam.form.base.
- Default templates now use Chameleon.
- Call update for all subforms when the update of the composed form is called.
- Initial release.