Package: zeam.form.ztk
zeam.form.ztkhelp you to integratezeam.form.basewith 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.Likezeam.form.basethe focus is to have an API usable by the
developer, not a support of theorical use-cases that you don’t need.ContentsExampleAdd formEdit formAPIActionsFieldsChangelog1.4.0 (2020/08/20)1.3.6 (2018/01/15)1.3.5 (2016/03/08)1.3.4 (2014/04/15)1.3.3 (2013/12/20)1.3.2 (2013/04/23)1.3.1 (2012/11/19)1.3 (2012/10/12)1.2.3 (2012/09/24)1.2.2 (2012/07/25)1.2.1 (2012/04/27)1.2 (2011/11/08)1.0 (2010/10/19)1.0rc2 (2010/07/16)1.0rc1 (2010/07/05)1.0b3 (2010/06/22)1.0b2 (2010/05/13)1.0b1 (2010/05/03)ExampleLet’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):
   pass

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):
    interface.implements(IPerson)

    first_name = None
    last_name = None
    age = None
    single = TrueAdd formYou can add a new Person in a clan like this:import zeam.form.ztk as form

class Add(form.Form):

    form.context(IClan)

    label = u"New person"
    fields = form.Fields(IPerson)
    actions =  form.Actions(
         form.AddAction("Add", factory=Person),
         form.CancelAction("Cancel"))
    actions['add'].fieldName = 'last_name'Edit formYou can edit a Person like this:class Edit(form.Form):

    form.context(IPerson)

    label = u"Change person details"
    fields = form.Fields(IPerson)
    actions =  form.Actions(
         form.EditAction("Update"),
         form.CancelAction("Cancel"))

    ignoreContent = FalseAPIAll the API ofzeam.form.baseis exported as well.ActionsAddActionAction which take an extra parameter, factory, to create an object
stored on the content object. The created object is added with the
help ofINameChooserto get its identifier. The optionfieldNamewill be used to lookup a value in the form data to
give as potential identifier toINameChooser. Afterwards the
created object is edited (like EditAction does) with the form data.EditActionAction which use the form data to change values on the content
object, designated by the form fields, after validation of the form
submission.CancelActionSimple action which return on default view of the content without
validating the form submission.FieldsCurrently supported fields:Date, Datetime: generate a text line input and parse/display the
date using the locale,TextLine, Text, Boolean, URI, Email, and numbers (Int, Float …),Password,Choice: generate a select or a radio boxes (widget moderadio),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.Changelog1.4.0 (2020/08/20)Moved to Python3.6+. Python2 support dropped.1.3.6 (2018/01/15)Fixed the use of defaultFactoryUpdated to newer versions of GTK packages1.3.5 (2016/03/08)Extended the Mock Library class to make it compatible with the newest
fanstatic api.1.3.4 (2014/04/15)Introducing the “defaultFactory” attributes fromzope.schema.
It was necessary to hijack the default value computing from zope.schema
DefaultProperty.1.3.3 (2013/12/20)Update collection javascript not to bind events on the document
anymore, but on the field. This prevent breakage if the events get
intercepted. The reordering buttons no longer submit the form, even
if the javascript isn’t included.Allow people to customize thedisabledattributes on fields.Update collection javascript to work with jQuery 1.9. It now
requires at least jQuery 1.7.1.3.2 (2013/04/23)Add a native email widget.1.3.1 (2012/11/19)Update fields to properly pass alongzope.schemathecontrainValuevalidator.Fix all fields to properly handle required (it got broken in the
previous release for some fields).1.3 (2012/10/12)Update fields and widgets to no longer proxyzope.schema. Instead they do their own validation and are
standalone (they can be created and used withoutzope.schema).Support more HTML 5 features, like for number fields, and extra
attributes that can be inserted with the help ofhtmlAttributes,
likeplaceholder…Add aCurrencyField, that can be used to display nicely
currencies.1.2.3 (2012/09/24)Update API to usezeam.form.base1.2.3.1.2.2 (2012/07/25)Adjust CheckboxWidgetExtractor to convertFalseinput to boolFalse.1.2.1 (2012/04/27)Improve choice widgets, to make possible to customize the source of
it. Add support for aIFormSourceBinder, that works like aIContextSourceBinderexcept it takes the form as parameter
instead of the context (thus giving access to request as well for
instance).Add a methoddeleteto the data manager.Now usegrokcore.chameleoninstead ofmegrok.chameleon.1.2 (2011/11/08)Improve error reporting in collection widgets. Thanks to Novareto
for the sponsorship.Add an validation option in collection widgets while adding and
removing values from it. Thanks to Novareto for the sponsorship.Improve Javascript for collection widgets. Add an extra with
fanstatic to automatically require required files.If a collection widget is required, it will by default display one
empty item in the collection when it is empty. That prevent an extra
click to add it.Various fixes inInvariantsValidator.SchemaWidgetExtractorandSchemaFieldnow catch Invalid
exceptions.Add support for the HTML 5 attribute required in every template. Use
the attribute novalidate on the form tag to disable it.Add a display widget for object and uri fields.Add an optionvalueLengthto the date widgets. Any Zope
formatter size can be use (short,medium…).1.0 (2010/10/19)Add amultiselectwidget for multiple choices.Add areadonlywidget.Add adisplaywidget for booleans and collections.Add HTML5 widgets for URIs.Schema field can be adapted now, even if they don’t have a interface
(if they provide an attribute __name__).Add more tests, fix issues in collection widgets, and invariant
validator.Translations are all located inzeam.form.base.Update to use the last version ofzeam.form.base.1.0rc2 (2010/07/16)Addradiowidget for choices.Add a display widgets for multiple choices.All fields have thefieldCSS class.Multiple choices widgets now properly respect the value of a vocabulary term.1.0rc1 (2010/07/05)Updated entry points registrations to be compatible with latestzeam.form.base.1.0b3 (2010/06/22)Field wrapper registration is now made thanks to an entry point.Added invariants validation.Added A generic adaptive datamanager that can adapt the form content to
one or several interfaces.1.0b2 (2010/05/13)Improve widget initialization, and testing layer support.Fix choice widgets when they are used with vocabulary factories.1.0b1 (2010/05/03)Initial release, with not all the widgets.