Am Dienstag, 19. Februar 2008 20:13 schrieb Marius Gedminas: > On Tue, Feb 19, 2008 at 04:46:29PM +0100, Hermann Himmelbauer wrote: > > class SearchFrom(z3c.form.EditForm): > > fields = z3c.form.field.Fields(copy.deepcopy(IPerson).select('name')) > > Strike out the deepcopy and you've got the correct solution: > > class SearchFrom(z3c.form.EditForm): > fields = z3c.form.field.Fields(IPerson).select('name') > > > However, this does not seem to work as still some things are referenced > > instead of copied, so copy.deepcopy seems to fail on interfaces. > > What are you trying to achieve? > > Zope 3 schema fields ought to be treated as immutable objects. > > > What's your opinion on this, how do you apply this pattern? > > We don't modify fields, ever. We use the power of zope.formlib (or > z3c.form) to get dynamic forms.
Yes, I also use z3c.form, but my problem is that the field has the "required" flag set to "True", which is appropriate for an add/edit form but may not be appropriate for a search form. If I change the "required" flag on the field level, e.g. in the update() method, the change is permanent in the interface, which is not appropriate. And changing it on the widget level seems to be very complicated, at least, I found no way to do it. Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 _______________________________________________ Zope3-users mailing list Zope3email@example.com http://mail.zope.org/mailman/listinfo/zope3-users