When api_type=json, return new captcha iden to caller when VCaptcha fails.

This commit is contained in:
David Hu
2012-01-04 13:08:14 -08:00
committed by Logan Hanks
parent 1d961335c8
commit 79bc0a734c

View File

@@ -70,6 +70,8 @@ class JsonResponse(object):
res = {}
if self._data:
res['data'] = self._data
if self._new_captcha:
res['captcha'] = get_iden()
res['errors'] = [(e[0], c.errors[e].message, e[1]) for e in self._errors]
return {"json": res}
@@ -121,6 +123,9 @@ class JsonResponse(object):
def _send_data(self, **kw):
self._data.update(kw)
def new_captcha(self):
self._new_captcha = True
class JQueryResponse(JsonResponse):
"""