Browse Source

pyi2phosts/postkey/views.py: redefine is_valid() and log validation errors

pull/1/head
Hidden Z 14 years ago
parent
commit
764e2e3f33
  1. 8
      pyi2phosts/postkey/views.py

8
pyi2phosts/postkey/views.py

@ -42,6 +42,14 @@ class AddForm(forms.ModelForm):
log.debug(u'hash: %s', self.data['b64hash']) log.debug(u'hash: %s', self.data['b64hash'])
data = validate_b64hash(data) data = validate_b64hash(data)
return data return data
def is_valid(self):
"""Log validation errors"""
is_valid = super(AddForm, self).is_valid()
if not is_valid:
for field in self.errors.keys():
log.info('ValidationError: [%s]: \"%s\" %s',
field, self.data[field], self.errors[field].as_text())
return is_valid
def addkey(request): def addkey(request):
if request.method == 'POST': if request.method == 'POST':

Loading…
Cancel
Save