Commit 0b8e072d by aa.gusti

perbaikan add error set default value

1 parent 76b43898
...@@ -709,19 +709,17 @@ class BaseView(object): ...@@ -709,19 +709,17 @@ class BaseView(object):
c = form.validate(controls) c = form.validate(controls)
except ValidationFailure as e: except ValidationFailure as e:
value = self.before_add() value = self.before_add()
# value = self.validation_failure(e.cstruct)
# value.update(self.before_add())
# form.render(appstruct=value)
# log.debug(e.cstruct)
# log.debug(e.field)
# efield = e.field
for f in e.field.children: for f in e.field.children:
if isinstance(f.typ, colander.Date): if isinstance(f.typ, colander.Date):
e.cstruct[f.name] = date_from_str( e.cstruct[f.name] = date_from_str(
e.cstruct[f.name]) e.cstruct[f.name])
if f.name == "captcha": if f.name == "captcha":
e.cstruct[f.name] = self.get_captcha_url() e.cstruct[f.name] = self.get_captcha_url()
value.update(e.cstruct) # if e.cstruct[f.name]:
for k in value:
if not e.cstruct.get(k):
e.cstruct[k] = value[k]
# value.update(e.cstruct)
form.set_appstruct(e.cstruct) form.set_appstruct(e.cstruct)
return self.returned_form(form, table, **kwargs) return self.returned_form(form, table, **kwargs)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!