Skip to content

Commit

Permalink
When api_type=json, return new captcha iden to caller when VCaptcha f…
Browse files Browse the repository at this point in the history
…ails.
  • Loading branch information
buddydvd authored and Logan Hanks committed Jan 17, 2012
1 parent 1d96133 commit 79bc0a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions r2/r2/lib/jsonresponse.py
Expand Up @@ -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}

Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 79bc0a7

Please sign in to comment.