On Oct 21, 2005, at 12:16 PM, James Allwyn wrote:

Following Christian's tweaks to the browser.py file (creating a
CustomSequenceWidget), I've got this working well in isolation - I can
add a ContactData object on its own no problem.

However, I've hit a brick wall about how to use the ContactData item
as a form element within another schema (say, IPerson). I've tried to
access it with variations upon:
    contact_data = Tuple(
        title = u'Contact Details',
        value_type = Object(
            title=u'Contact Datum'))

To me, this or List() are the only ones that make any sense... Here's why:

One of the things you're doing with this interface is implicitly telling z3 how you want this field to be displayed (because, by default, it makes that decision based on the field "type". With a List(), etc., you get the sub-schema displayed and then the option to "add *" or "removed checked" -- an auto-generated multi-widget.

It it's not a standard field type, z3's not going to know what do do with it, and I think you'd have to use the "<widget>" sub-config in your zcml to tell it explicitly what widget to use when building add/edit forms.

and invoking the browser class for the add view in the configure.zcml
for the User:


In effect, this method doesn't use ContactData at all, it replicates
its functionality out of a Tuple of ContactDatum objects in the
IPerson itself. But what I want to do is be able to put a ContactData
element into IPerson and have it 'just work', in the same way I can
for, say, TextLine, or Bool.

Hmm, we'll need some more details here... what do you mean by "just work"? In what context? Add/edit? Final rendering? If the later, I believe you will need to add your view class that processes the list so that ZPT can handle it with "repeat" (at least, that's what I would do...).


Zope3-users mailing list

Reply via email to