From 79bc0a734c4cb5221d5437f726f886874abaf510 Mon Sep 17 00:00:00 2001 From: David Hu Date: Wed, 4 Jan 2012 13:08:14 -0800 Subject: [PATCH] When api_type=json, return new captcha iden to caller when VCaptcha fails. --- r2/r2/lib/jsonresponse.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/r2/r2/lib/jsonresponse.py b/r2/r2/lib/jsonresponse.py index 0bd8f0ccbd..bd2777acaa 100644 --- a/r2/r2/lib/jsonresponse.py +++ b/r2/r2/lib/jsonresponse.py @@ -70,6 +70,8 @@ def make_response(self): 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 @@ def replace_things(self, things, keep_children = False, def _send_data(self, **kw): self._data.update(kw) + def new_captcha(self): + self._new_captcha = True + class JQueryResponse(JsonResponse): """