Skip to main content

Composed form support for zeam.form

Project description

This package let you defines forms containing other forms in zeam.form.base.

Example

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.

API

Classes

ComposedForm

This class define a form which able to contain other forms. It behave like a zeam.form.base Form, but does use its fields.

SubForm

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.

Directives

All those directives comes from Grokcore component. Please refer to the Grok documentation for more information.

context

Define for which object the form/sub form is available.

layer

Define the skin for which the form/sub form is aviable.

require

Define a permission need to access the form.

template

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.

view

On a sub form, define for which form the sub form is available.

order

Let you specify a number to sort your sub form afterwards using that setting.

Changelog

1.1 (2010/07/16)

  • Default templates now use Chameleon.

  • Call update for all subforms when the update of the composed form is called.

1.0 (2010/05/03)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zeam.form.composed-1.1.tar.gz (7.9 kB view details)

Uploaded Source

File details

Details for the file zeam.form.composed-1.1.tar.gz.

File metadata

File hashes

Hashes for zeam.form.composed-1.1.tar.gz
Algorithm Hash digest
SHA256 edd59ddea2b0b6c1dbe4a7381e53c41dbeaf37f0516c215d8aff27554dc2eb87
MD5 655ba83da91d3d8a41df1212cc145bcf
BLAKE2b-256 b90822681e796aefd4a5444852e65fc1b9829d0131fa90f8ba05413f62dc22d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page