def captcha_get_ajax(): contents_img, key, raw = captcha() hash_key = base64.b64encode(bz2.compress(key)) return jsonify(contents_img=contents_img, hash_key=hash_key)
def get_form(): form = CommentForm(request.form) contents_img, key, raw = captcha() form.hash_key.data = base64.b64encode(bz2.compress(key)) return dict(form=form, contents_img=contents_img)