Am Donnerstag, 19. April 2007 17:06 schrieb Sascha Ottolski:
> Am Donnerstag 19 April 2007 schrieb Hermann Himmelbauer:
> >  Tried it out and it seems to work for Objects() in the schema.
> > However, for Lists(value_type=Object()), I get permission problems:
> not a real answer, but another hint:

Ah, that's nice and easy. Did not solve the permission problems, though. I 
found out that the list object, which I defined the Lists() schema for, is 
not a python list, instead it's a sqlalchemy.orm.attributes.InstrumentedList. 
Therefore it seems I have to set the permissions on this object, tried it 
like that: 

    <class class="sqlalchemy.orm.attributes.InstrumentedList">
            attributes="__iter__ __getitem__"

The permission problems are gone now, but I have still some object nesting 
problems with formlib. Here's what I have:

I have an object "Kunde", which 1:1 relates to a "Fp" object. That Fp object 
relates 1:n to an "Email" object. I defined interfaces for all of these 
objects and configured them. The browser code looks now like this:

fp_widget =CustomWidgetFactory(ObjectWidget,Fp)
email_widget = CustomWidgetFactory(ObjectWidget,Email)
emails_widget = CustomWidgetFactory(ListSequenceWidget, 

class EditKunde(form.Form):
    form_fields = form.Fields(IKunde)
    form_fields['fp'].custom_widget = fp_widget
    # so far, this works, the Fp object is displayed.

    # Now I need to apply the custom widget to the fp.emails list object
    form_fields['fp'].emails.custom_widget = emails_widget
    # Hmmm, this has no effect, I receive a ComponentLookupError:

ComponentLookupError: ((<zope.schema._field.Object object at 0x31e9910>, 
<zc.resourcelibrary.publication.Request instance 
URL=http://localhost:8080/act/managekunde/index.html>), <InterfaceClass>, u'')

Moreover it would be nice if I could omit some attributes of the sub-objects - 
do you know if there's some way to do that? E.g. something 
like "form_fields.omit('')", or even more something 
like "form_fields.omit('')?

Best Regards,

GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
Zope3-users mailing list

Reply via email to