[Zope3-Users] z3c.form - howto ignore the context for single widgets in an Edit form?

Christophe Combelles ccomb at free.fr
Thu Feb 7 14:01:20 EST 2008

Hermann Himmelbauer a écrit :
> Hi,
> I'm creating a simple user-administration, 

Hi, I'm currently doing exactly the same thing :)
(user management with z3c.form, and the class for my users derives from 
zope.app.authentication.principalfolder.InternalPrincipal )

>which requires the user to type in 
> the password and a password confirmation. For that, I have an interface which 
> contains the attributes "password" and "password_confirm". Of course, only 
> the password is stored as an object attribute.
> When I now use form.EditForm for editing this object, z3c.form raises an error 
> as it cannot find the required attribute in the context for 
> the "password_confirm" widget.

I'm not sure this is a good idea to have "password_confirm" in the interface, 
because it would mean that your user has two passwords (from an interface 
point-of-view). The password confirmation should just be part of the form 
validation. Maybe you have to manually add a field in the form (I'm just going 
to try that).
If you really want to have both password in the interface, you have to implement 
both attribute, and the password_confirm can just be a property whose 'get' 
retrieves the password and whose 'set' just checks that the value (that should 
actually be a hash) is the same as the 'password'.


> What's the suggested way to circumvent this problem?
> Best Regards,
> Hermann

More information about the Zope3-users mailing list