megrok.z3cform.composed
megrok.z3cform.composed is a package dedicated to define and register composed forms. Composed forms are forms built from a collection of sub forms.
megrok.z3cform.composed is based on z3c.form and megrok.z3cform.base.
Getting started
We import the needed dependencies:
>>> import grokcore.view as grok >>> import megrok.z3cform.composed >>> from megrok.z3cform.composed import ComposedForm, SubForm
We import the components utilities:
>>> from zope.component import getMultiAdapter >>> from zope.publisher.browser import TestRequest
Defining a composed form
Context
A form needs a context. Let’s create a simple model for test purposes:
>>> class MyContent(object): ... pass
Declaration
>>> class Form(ComposedForm): ... grok.context(MyContent)
Registration
>>> grok_component('composed', Form)
True
Query
>>> content = MyContent() >>> request = TestRequest()>>> composed = getMultiAdapter((content, request), name="form") >>> composed <megrok.z3cform.composed.tests.Form object at ...>>>> composed.subforms []>>> composed.updateForm() >>> composed.subforms []
Defining sub forms
Declaration
>>> class SubFormOne(SubForm): ... grok.context(MyContent) ... megrok.z3cform.composed.order(2) ... megrok.z3cform.composed.view(Form)>>> class SubFormTwo(SubForm): ... grok.context(MyContent) ... megrok.z3cform.composed.order(1) ... megrok.z3cform.composed.view(Form)
Registration
>>> grok_component('one', SubFormOne) True>>> grok_component('one', SubFormTwo) True
Query
>>> composed.subforms []>>> composed.updateForm() >>> composed.subforms [<megrok.z3cform.composed.tests.SubFormTwo object at ...>, <megrok.z3cform.composed.tests.SubFormOne object at ...>]>>> for sub in composed.subforms: ... print sub.prefix, sub.parentForm subformtwo <megrok.z3cform.composed.tests.Form object at ...> subformone <megrok.z3cform.composed.tests.Form object at ...>
Changelog
0.1 (2009-10-27)
Initial release
Metadata
Release files for megrok.z3cform.composed 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| megrok.z3cform.composed-0.1.tar.gz | 4.5 kB | Without provenance | Details for megrok.z3cform.composed-0.1.tar.gz |
Release files / megrok.z3cform.composed-0.1.tar.gz
| Download URL | megrok.z3cform.composed-0.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d94b87bc81322748eaa3fdb63cded155bfb80f4cea808972258554d7e1a806a2
|
|
BLAKE2b-256 checksum How to use checksums |
fe0be52900cc95d8b9d08141152e023e583d68e96b7e0e399395d180f21b08b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for megrok.z3cform.composed 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.