z3c.form 1.3.0, z3c.formui 1.0.1, and z3c.formdemo 1.1.0 released!
Hello everyone, Roger and I have received a great deal of feedback about the z3c.form* packages. Several people reported that they immediately started using it for their development. Thanks to those people, we were able to identify many bugs and determined new features. The result is a new round of releases! Again for the curious and impatient ... --------------------------------------- We have added two more demos: * An "Address Book" implements a non-trivial example of an address book, including multiple addresses and E-mails. It demonstrates the use of sub-forms, writing custom widgets and composite content. * An "SQL Message" demo reimplemnets the simple "Hello World!" demo only using queries to the Gadfly database. The example adds to the original demo by also providing a message overview screen, since the ZMI is not helpful for pure SQL data. To run the demos do the following:: $ svn co svn://svn.zope.org/repos/main/z3c.formdemo/trunk formdemo $ cd formdemo $ python bootstrap.py $ ./bin/buildout -N $ ./bin/demo fg Now you can access the demo under: http://localhost:8080/ Note: Python's Cheeseshop seems to be extremely slow today, so this might take a while. Alternatively, you can use Zope's distribution server: http://download.zope.org/distribution. On the Javascript Front ----------------------- Paul Carduner, as part of his GSOC project, is developing a super-cool extension to the z3c.form* packages that will make it very easy for the Python developer to write AJAX-driven applications. My hope is that Paul will have the first iteration and a demo done in a few weeks! So stay tuned... Changes ------- z3c.form ~~~~~~~~ - Feature: In an edit form applying the data and generating all necessary messages was all done within the "Apply" button handler. Now the actual task of storing is factored out into a new method called "applyChanges(data)", which returns whether the data has been changed. This is useful for forms not dealing with objects. - Feature: Added support for ``hidden`` fields. You can now use the ``hidden`` mode for widgets which should get rendered as ``<input type="hidden" />``. Note: Make sure you use the new formui templates which will avoid rendering labels for hidden widgets or adjust your custom form macros. - Feature: Added ``missing_value`` support to data/time converters - Feature: Added named vocabulary lookup in ``ChoiceTerms`` and ``CollectionTerms``. - Implemented support for ``FileUpload`` in ``FileWidget``. * Added helper for handling ``FileUpload`` widgets: + ``extractContentType(form, id) Extracts the content type if ``IBytes``/``IFileWidget`` was used. + ``extractFileName(form, id, cleanup=True, allowEmtpyPostFix=False)`` Extracts a filename if ``IBytes``/``IFileWidget`` was used. Uploads from win/IE need some cleanup because the filename includes also the path. The option ``cleanup=True`` will do this for you. The option ``allowEmtpyPostFix`` allows you to pass a filename without extensions. By default this option is set to ``False`` and will raise a ``ValueError`` if a filename doesn't contain an extension. * Created afile upload data converter registered for ``IBytes``/``IFileWidget`` ensuring that the converter will only be used for fiel widgets. The file widget is now the default for the bytes field. If you need to use a text area widget for ``IBytes``, you have to register a custom widget in the form using:: fields['foobar'].widgetFactory = TextWidget - Feature: Originally, when an attribute access failed in Unauthorized or ForbiddenAttribute exceptions, they were ignored as if the attribute would have no value. Now those errors are propagated and the system will fail providing the developer with more feedback. The datamanager also grew a new ``query()`` method that returns always a default and the ``get()`` method propagates any exceptions. - Feature: When writing to a field is forbidden due to insufficient priviledges, the resulting widget mode will be set to "display". This behavior can be overridden by explicitely specifying the mode on a field. - Feature: Added an add form implementation against ``IAdding``. While this is not an encouraged method of adding components, many people still use this API to extend the ZMI. - Feature: The ``IFields`` class' ``select()`` and ``omit()`` method now support two ketword arguments "prefix" and "interface" that allow the selection and omission of prefixed fields and still specify the short name. Thanks to Nikolay Kim for the idea. - Feature: HTML element ids containing dots are not very good, because then the "element#id" CSS selector does not work and at least in Firefox the attribute selector ("element[attr=value]") does not work for the id either. Converted the codebase to use dashes in ids instead. - Bug/Feature: The ``IWidgets`` component is now an adapter of the form content and not the form context. This guarantees that vocabulary factories receive a context that is actually useful. - Bug: The readonly flag within a field was never honored. When a field is readonly, it is displayed in "display" mode now. This can be overridden by the widget manager's "ignoreReadonly" flag, which is necessary for add forms. - Bug: The mode selection made during the field layout creation was not honored and the widget manager always overrode the options providing its value. Now the mode specified in the field is more important than the one from the widget manager. - Bug: It sometimes happens that the sequence widget has the no-value token as one element. This caused ``displayValue()`` to fail, since it tried to find a term for it. For now we simply ignore the no-value token. - Bug: Fixed the converter when the incoming value is an empty string. An empty string really means that we have no value and it is thus missing, returning the missing value. - Bug: Fix a slightly incorrect implementation. It did not cause any harm in real-world forms, but made unit testing much harder, since an API expectation was not met correctly. - Bug: When required selections where not selected in radio and checkbox widgets, then the conversion did not behave correctly. This also revealed some issues with the converter code that have been fixed now. - Bug: When fields only had a vocabulary name, the choice terms adaptation would fail, since the field was not bound. This has now been corrected. - Documentation: Integrated English language and content review improvements by Roy Mathew in ``form.txt``. z3c.formui ~~~~~~~~~~ - Bug: Make sure we use the id for the "for" attribute of the "label" element and not the name. This has worked until recently, because the name and id were the same, but they are different now. z3c.formdemo ~~~~~~~~~~~~ - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with non-object data. Specificically, this small application demonstrates using a Gadfly database using pure SQL calls without any ORM. - Feature: New "Address Book" demo that demonstrates more complex use cases, such as subforms, composite widgets, and mappings/lists Enjoy! Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training
Hi Stephan. This is some really awesome work and some great new examples as well. There is more to explore and to anticipate with ajax - it is all really very excellent. When running the demo, I needed to add zope.rdb to the setup.py and its corresponding meta and configuration files to site.zcml. Other than this, everything worked great and some more things to learn for sure. :-) Many thanks for this fine work to help us all with forms! Regards, David Stephan Richter wrote:
Hello everyone,
Roger and I have received a great deal of feedback about the z3c.form* packages. Several people reported that they immediately started using it for their development. Thanks to those people, we were able to identify many bugs and determined new features. The result is a new round of releases!
Again for the curious and impatient ... ---------------------------------------
We have added two more demos:
* An "Address Book" implements a non-trivial example of an address book, including multiple addresses and E-mails. It demonstrates the use of sub-forms, writing custom widgets and composite content.
* An "SQL Message" demo reimplemnets the simple "Hello World!" demo only using queries to the Gadfly database. The example adds to the original demo by also providing a message overview screen, since the ZMI is not helpful for pure SQL data.
To run the demos do the following::
$ svn co svn://svn.zope.org/repos/main/z3c.formdemo/trunk formdemo $ cd formdemo $ python bootstrap.py $ ./bin/buildout -N $ ./bin/demo fg
Now you can access the demo under:
Note: Python's Cheeseshop seems to be extremely slow today, so this might take a while. Alternatively, you can use Zope's distribution server: http://download.zope.org/distribution.
On the Javascript Front -----------------------
Paul Carduner, as part of his GSOC project, is developing a super-cool extension to the z3c.form* packages that will make it very easy for the Python developer to write AJAX-driven applications. My hope is that Paul will have the first iteration and a demo done in a few weeks! So stay tuned...
Changes -------
z3c.form ~~~~~~~~
- Feature: In an edit form applying the data and generating all necessary messages was all done within the "Apply" button handler. Now the actual task of storing is factored out into a new method called "applyChanges(data)", which returns whether the data has been changed. This is useful for forms not dealing with objects.
- Feature: Added support for ``hidden`` fields. You can now use the ``hidden`` mode for widgets which should get rendered as ``<input type="hidden" />``.
Note: Make sure you use the new formui templates which will avoid rendering labels for hidden widgets or adjust your custom form macros.
- Feature: Added ``missing_value`` support to data/time converters
- Feature: Added named vocabulary lookup in ``ChoiceTerms`` and ``CollectionTerms``.
- Implemented support for ``FileUpload`` in ``FileWidget``.
* Added helper for handling ``FileUpload`` widgets:
+ ``extractContentType(form, id)
Extracts the content type if ``IBytes``/``IFileWidget`` was used.
+ ``extractFileName(form, id, cleanup=True, allowEmtpyPostFix=False)``
Extracts a filename if ``IBytes``/``IFileWidget`` was used.
Uploads from win/IE need some cleanup because the filename includes also the path. The option ``cleanup=True`` will do this for you. The option ``allowEmtpyPostFix`` allows you to pass a filename without extensions. By default this option is set to ``False`` and will raise a ``ValueError`` if a filename doesn't contain an extension.
* Created afile upload data converter registered for ``IBytes``/``IFileWidget`` ensuring that the converter will only be used for fiel widgets. The file widget is now the default for the bytes field. If you need to use a text area widget for ``IBytes``, you have to register a custom widget in the form using::
fields['foobar'].widgetFactory = TextWidget
- Feature: Originally, when an attribute access failed in Unauthorized or ForbiddenAttribute exceptions, they were ignored as if the attribute would have no value. Now those errors are propagated and the system will fail providing the developer with more feedback. The datamanager also grew a new ``query()`` method that returns always a default and the ``get()`` method propagates any exceptions.
- Feature: When writing to a field is forbidden due to insufficient priviledges, the resulting widget mode will be set to "display". This behavior can be overridden by explicitely specifying the mode on a field.
- Feature: Added an add form implementation against ``IAdding``. While this is not an encouraged method of adding components, many people still use this API to extend the ZMI.
- Feature: The ``IFields`` class' ``select()`` and ``omit()`` method now support two ketword arguments "prefix" and "interface" that allow the selection and omission of prefixed fields and still specify the short name. Thanks to Nikolay Kim for the idea.
- Feature: HTML element ids containing dots are not very good, because then the "element#id" CSS selector does not work and at least in Firefox the attribute selector ("element[attr=value]") does not work for the id either. Converted the codebase to use dashes in ids instead.
- Bug/Feature: The ``IWidgets`` component is now an adapter of the form content and not the form context. This guarantees that vocabulary factories receive a context that is actually useful.
- Bug: The readonly flag within a field was never honored. When a field is readonly, it is displayed in "display" mode now. This can be overridden by the widget manager's "ignoreReadonly" flag, which is necessary for add forms.
- Bug: The mode selection made during the field layout creation was not honored and the widget manager always overrode the options providing its value. Now the mode specified in the field is more important than the one from the widget manager.
- Bug: It sometimes happens that the sequence widget has the no-value token as one element. This caused ``displayValue()`` to fail, since it tried to find a term for it. For now we simply ignore the no-value token.
- Bug: Fixed the converter when the incoming value is an empty string. An empty string really means that we have no value and it is thus missing, returning the missing value.
- Bug: Fix a slightly incorrect implementation. It did not cause any harm in real-world forms, but made unit testing much harder, since an API expectation was not met correctly.
- Bug: When required selections where not selected in radio and checkbox widgets, then the conversion did not behave correctly. This also revealed some issues with the converter code that have been fixed now.
- Bug: When fields only had a vocabulary name, the choice terms adaptation would fail, since the field was not bound. This has now been corrected.
- Documentation: Integrated English language and content review improvements by Roy Mathew in ``form.txt``.
z3c.formui ~~~~~~~~~~
- Bug: Make sure we use the id for the "for" attribute of the "label" element and not the name. This has worked until recently, because the name and id were the same, but they are different now.
z3c.formdemo ~~~~~~~~~~~~
- Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with non-object data. Specificically, this small application demonstrates using a Gadfly database using pure SQL calls without any ORM.
- Feature: New "Address Book" demo that demonstrates more complex use cases, such as subforms, composite widgets, and mappings/lists
Enjoy!
Regards, Stephan
On Saturday 23 June 2007 01:44, David Pratt wrote:
Hi Stephan. This is some really awesome work and some great new examples as well. There is more to explore and to anticipate with ajax - it is all really very excellent.
Thanks for looking at the packages seriously. BTW, over the weekend I fleshed out some thoughts on the group subforms. I will try something tomorrow.
When running the demo, I needed to add zope.rdb to the setup.py and its corresponding meta and configuration files to site.zcml.
Yes, thanks for the report. Cheeseshop was slow on Friday, so I could not try the package. I just released formdemo 1.1.1, which fixes the problem. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training
On Sun, 24 Jun 2007 22:42:35 -0400, Stephan Richter wrote:
Yes, thanks for the report. Cheeseshop was slow on Friday, so I could not try the package. I just released formdemo 1.1.1, which fixes the problem.
Thanks for the z3c.form package and the demo. There is an optionalChoiceField addition to browser.py which fixes an error on the 'All Widgets' demos: $ svn diff Index: src/z3c/formdemo/widgets/browser.py =================================================================== --- src/z3c/formdemo/widgets/browser.py (revision 77026) +++ src/z3c/formdemo/widgets/browser.py (working copy) @@ -44,6 +44,7 @@ bytesField = FieldProperty(interfaces.IAllFields['bytesField']) bytesLineField = FieldProperty(interfaces.IAllFields['bytesLineField']) choiceField = FieldProperty(interfaces.IAllFields['choiceField']) + optionalChoiceField = FieldProperty(interfaces.IAllFields['optionalChoiceField']) dateField = FieldProperty(interfaces.IAllFields['dateField']) datetimeField = FieldProperty(interfaces.IAllFields['datetimeField']) decimalField = FieldProperty(interfaces.IAllFields['decimalField']) ERROR SiteError http://localhost:8081/++skin++Z3CFormDemo/widgets.html Traceback (most recent call last): File "/software/formdemo/eggs/tmpdsM7XZ/zope.publisher-3.4.0b1_r76188-py2.4.egg/zope/publisher/publish.py", line 133, in publish File "/software/formdemo/eggs/tmpK-tlc_/zope.app.publication-3.4.0a1_2-py2.4.egg/zope/app/publication/zopepublication.py", line 167, in callObject File "/software/formdemo/eggs/tmpdsM7XZ/zope.publisher-3.4.0b1_r76188-py2.4.egg/zope/publisher/publish.py", line 108, in mapply - __traceback_info__: <security proxied z3c.pagelet.zcml.AllFieldsForm instance at 0x8b9038c> File "/software/formdemo/eggs/tmpdsM7XZ/zope.publisher-3.4.0b1_r76188-py2.4.egg/zope/publisher/publish.py", line 114, in debug_call File "/software/formdemo/src/z3c/formdemo/widgets/browser.py", line 86, in __call__ self.update() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/form.py", line 139, in update super(Form, self).update() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/form.py", line 88, in update self.updateWidgets() File "/software/formdemo/src/z3c/formdemo/widgets/browser.py", line 82, in updateWidgets super(AllFieldsForm, self).updateWidgets() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/form.py", line 200, in updateWidgets self.widgets.update() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/field.py", line 255, in update widget.update() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/browser/select.py", line 46, in update super(SelectWidget, self).update() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/widget.py", line 176, in update super(SequenceWidget, self).update() File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/widget.py", line 96, in update value = zope.component.getMultiAdapter( File "/software/formdemo/eggs/z3c.form-1.3.0-py2.4.egg/z3c/form/datamanager.py", line 48, in get return getattr(context, self.field.__name__) AttributeError: 'AllFields' object has no attribute 'optionalChoiceField'
On Sunday 24 June 2007 23:11, Jeff Kowalczyk wrote:
On Sun, 24 Jun 2007 22:42:35 -0400, Stephan Richter wrote:
Yes, thanks for the report. Cheeseshop was slow on Friday, so I could not try the package. I just released formdemo 1.1.1, which fixes the problem.
Thanks for the z3c.form package and the demo.
There is an optionalChoiceField addition to browser.py which fixes an error on the 'All Widgets' demos:
Thanks, I already have released zc.formdemo 1.1.2, which fixes the problem. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training
Again for the curious and impatient ... ---------------------------------------
We have added two more demos:
* An "Address Book" implements a non-trivial example of an address book, including multiple addresses and E-mails. It demonstrates the use of sub-forms, writing custom widgets and composite content.
This demo is really impressive!
* An "SQL Message" demo reimplemnets the simple "Hello World!" demo only using queries to the Gadfly database. The example adds to the original demo by also providing a message overview screen, since the ZMI is not helpful for pure SQL data.
Thanks for this one :) -- Maciej Wisniowski
participants (4)
-
David Pratt -
Jeff Kowalczyk -
Maciej Wisniowski -
Stephan Richter