1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 12:34:17 +00:00

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

This commit is contained in:
Hidden Z 2010-12-30 20:06:40 +00:00
parent 83928b6dad
commit 764e2e3f33

View File

@ -42,6 +42,14 @@ class AddForm(forms.ModelForm):
log.debug(u'hash: %s', self.data['b64hash'])
data = validate_b64hash(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):
if request.method == 'POST':