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 _______________________________________________ Zope-Announce maillist - Zope-Announce@zope.org http://mail.zope.org/mailman/listinfo/zope-announce Zope-Announce for Announcements only - no discussions (Related lists - Users: http://mail.zope.org/mailman/listinfo/zope Developers: http://mail.zope.org/mailman/listinfo/zope-dev )