skip to navigation
skip to content

dolmen.forms.ztk 2.4.1

Zope Toolkit support for dolmen.forms

Downloads ↓

dolmen.forms.ztk help you to integrate dolmen.forms.base with the Zope Tool Kit. It provides:

  • Form fields generation out of zope.schema fields, and zope.schema fields listed in a Zope interface,
  • Widgets for those fields,
  • Default action to Add, Edit a content, Cancel a current action by returning on the default view of a content.

Like dolmen.forms.base the focus is to have an API usable by the developer, not a support of theorical use-cases that you don't need.


Let's create a form to edit a content. Here we have an interface for our content:

from zope import schema, interface

class IClan(interface.Interface):

class IPerson(interface.Interface):

   first_name = schema.TextLine(title=u"First Name")
   last_name = schema.TextLine(title=u"Last Name")
   age = schema.Int(title=u"Age", required=False)
   single = schema.Bool(title=u"Is single ?", default=True)

We assume that a Person is in a Clan. We can implement a Person:

from persistence import Persistent

class Person(Persistent):

    first_name = None
    last_name = None
    age = None
    single = True


All the API of dolmen.forms.base is exported as well.


Currently supported fields:

  • Date, Datetime: generate a text line input and parse/display the date using the locale,
  • TextLine, Text, Boolean, URI, and numbers (Int, Float ...),
  • Password,
  • Choice: generate a select or a radio boxes (widget mode radio),
  • Object,
  • Collections: List, Set, Tuple in input and display mode:
    • Collection of choices: generate a widget with a list of checkboxes,
    • Collection of objects: generate a table to edit multiple objects,
    • Other collection: generate a widget with generic add an remove actions.

For more documentation, please report to the doctests included in the code.


2.4.1 (2015-12-01)

  • Assert translation of error message
  • Corrected date widget class names
  • Made the collection.js work

2.3.3 (2014-10-09)

  • Using now the latest changes in dolmen.clockwork : date and datetime parsers are named adapters. We're using the valueType to query the right adapter.
  • Reduced the dependencies

2.3.2 (2014-05-13)

  • Correction of the packaging that led to a brownbag release. MANIFEST now lists the templates correctly.

2.3.1 (2014-04-11)

  • Corrected the GenericAdaptiveDataManager, to work if the content already provides the interface.
  • All the fields now use the BaseField baseclas, making them aware of the defaultFactory.

2.3 (2014-04-11)

  • Backported the changes from the latest zeam.form. This includes :
    • ZTK fields are no longer adapters but standalone fields
    • New templates incorporating the htmlAttributes values
  • Added the defaultFactory computing to the defaultValue property
  • Remove the readonly and hidden extractors. All the widgets use the "input" extractor as a fallback. This can be overriden by registering an "hidden" or "readonly" extractor for the target fields.
  • Date fields now use the dolmen.clockwork package to compute the language related format of the date and time.

2.2.2 (2012-11-28)

  • Fixed the object / multi object / list object templates. It will now correctly display the errors, thanks to the changes in dolmen.forms.base.

2.2.1 (2012-11-16)

  • The checkbox widget now has a 'presence marker', fixing all the problems related to empty requests and NO_VALUE resolutions.

2.2 (2012-10-18)

  • fixed test to pass, after has been dropped
  • added Hidden field extractor for date, time, choice, number and bool

2.1.2 (2012-03-30)

  • added Object field to replace zope.schema.Object and overcome some bugs.

2.1.1 (2012-02-06)

  • Fixed the "Link" widget. It now uses the normalized getContentData from the form to get the right context.
  • Cleaned up dependencies.

2.1 (2012-01-20)

  • tests on numbers widgets (int and float)
  • added a display field for text rendering in a pre element

2.0 (2012-01-17)

  • Updated to follow the major changes initiated by dolmen.view and cromlech.browser.

2.0b1 (2012-01-10)

  • Removed all the provided Actions classes (Add and Update). They do not belong here, they are to be provided by dolmen.forms.crud.
  • Changed the tests to fit the latests modification from and cromlech.browser.

2.0a7 (2011-09-20)

  • validation.Data reraise KeyError of dataManager.get(name) in a more logical attribute error

2.0a6 (2011-09-20)

  • fix error on InvariantValidator and added test for case when invariant depends on data not present in form

2.0a5 (2011-09-19)

  • Validators are now form aware. Echoed the changed in InvariantValidator. It now gives the Data wrapper the form's dataManager.

2.0a4 (2011-08-19)

  • corrected bug on number extraction and added tests

2.0a3 (2011-08-18)

  • Better extraction of Date and Time, u'' means None. As a consequence a date can be deleted !

2.0a2 (2011-06-30)

  • Macros access is no longer using attributes, but a dict-like interface.

2.0a1 (2011-05-11)

  • forking zeam.form.ztk
File Type Py Version Uploaded on Size # downloads
dolmen.forms.ztk-2.4.1.tar.gz (md5) Source 2015-12-01 40KB 0