[form fields] nicer behaviour of the password field: don't put internal field value on edition (triggering validation error if one validation without removing the value, due to confirmation mismatch), and don't show the field as required in such case
--- a/web/formfields.py Thu Feb 18 11:06:40 2010 +0100
+++ b/web/formfields.py Thu Feb 18 11:08:00 2010 +0100
@@ -413,12 +413,17 @@
class PasswordField(StringField):
widget = fw.PasswordInput
+ def form_init(self, form):
+ if self.eidparam and form.edited_entity.has_eid():
+ # see below: value is probably set but we can't retreive it. Ensure
+ # the field isn't show as a required field on modification
+ self.required = False
def typed_value(self, form, load_bytes=False):
if self.eidparam:
# no way to fetch actual password value with cw
if form.edited_entity.has_eid():
- return INTERNAL_FIELD_VALUE
+ return ''
return self.initial_typed_value(form, load_bytes)
return super(PasswordField, self).typed_value(form, load_bytes)