web/form.py
branchstable
changeset 1860 ce67132ced1c
parent 1855 4e2eeb88780f
child 1861 21fae1546ac4
equal deleted inserted replaced
1859:b068abd45a1c 1860:ce67132ced1c
   379     def form_field_value(self, field, load_bytes=False):
   379     def form_field_value(self, field, load_bytes=False):
   380         """return field's *typed* value"""
   380         """return field's *typed* value"""
   381         myattr = '%s_%s_default' % (field.role, field.name)
   381         myattr = '%s_%s_default' % (field.role, field.name)
   382         if hasattr(self, myattr):
   382         if hasattr(self, myattr):
   383             return getattr(self, myattr)()
   383             return getattr(self, myattr)()
       
   384         if callable(value):
       
   385             value = value(self)
   384         return field.initial
   386         return field.initial
   385 
   387 
   386     def form_field_error(self, field):
   388     def form_field_error(self, field):
   387         """return validation error for widget's field, if any"""
   389         """return validation error for widget's field, if any"""
   388         if self._field_has_error(field):
   390         if self._field_has_error(field):