[Zope3-dev] RFC: Make <widget />
subdirective support sequence/items widgets
Dominik Huber
dominik.huber at projekt01.ch
Wed Jun 29 04:00:06 EDT 2005
Philipp von Weitershausen wrote:
> Actually, I'm not entirely satisfied with the implementation yet. It
> still doesn't work sufficiently with subwidgets of sequence widgets.
I'm not sure if I use the sequence widgets correctly. Two days ago I
used the sequence widget the second time (The first time I used them
within X3.0. Everything seems to be equal except that the
CustomWidgetFactory cannot used for custom sequence widgets anymore
(->CustomSequenceWidgetFactory)). Are there other ways sequence widgets
should be used?
interfaces.py:
-------------
class IFoo(Interface:
attribute1 = TextLine()
attribute2 = TextLine()
attribute3 = TextLine()
class IFoos(Interface):
foos = Tuple(title=_( default=(), value_type=Object(schema=IFoo))
edit.py:
-------
from zope.app.form import CustomWidgetFactory, CustomSequenceWidgetFactory
from zope.app.form.browser import ObjectWidget, SequenceWidget
from app import Foo
foo_widget = CustomWidgetFactory(ObjectWidget, Foo)
foos_widget = CustomSequenceWidgetFactory(SequenceWidget, foo_widget)
browser.zcml:
--------------
<browser:editform
for=".interfaces.IFoos"
schema=".interfaces.IFoos"
label="Edit Foos"
name="edit.html"
menu="zmi_views" title="Edit Manager"
permission="zope.ManageContent">
<widget
field="foos"
class=".edit.foos_widget"
/>
</browser:editform>
What exactly doesn't work sufficiently with subwidgets in your opinion?
IMO, it woud be cool if there is a way to hide and order the fields of
the subwidgets.
> So, I will likely merge after 3.1, but possibly on both 3.1 branch and
> the trunk. I consider this a bugfix.
This example pattern does not work anymore with the current trunk, but
with your branch.
It would be better if you could merge before 3.1, because IMO this seems
to be a bug too.
Regards,
Dominik
More information about the Zope3-dev
mailing list