[tor-commits] [bridgedb/master] Add a docstring and comment to checkResponse() in ReCaptchaProtectedResource.

isis at torproject.org isis at torproject.org
Wed Mar 26 05:49:32 UTC 2014


commit 228d7e0856cb88723531cb76db12c3a9b32acd5a
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Mar 26 04:57:56 2014 +0000

    Add a docstring and comment to checkResponse() in ReCaptchaProtectedResource.
---
 lib/bridgedb/HTTPServer.py |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/bridgedb/HTTPServer.py b/lib/bridgedb/HTTPServer.py
index f4ab592..24a970f 100644
--- a/lib/bridgedb/HTTPServer.py
+++ b/lib/bridgedb/HTTPServer.py
@@ -466,6 +466,17 @@ class ReCaptchaProtectedResource(CaptchaProtectedResource):
                       % (Util.logSafely(clientIP), request.args))
 
         def checkResponse(solution, request):
+            """Check the :class:`txrecaptcha.RecaptchaResponse`.
+
+            :type solution: :class:`txrecaptcha.RecaptchaResponse`.
+            :param solution: The client's CAPTCHA solution, after it has been
+                submitted to the reCaptcha API server.
+            """
+            # This valid CAPTCHA result from this function cannot be reliably
+            # unittested, because it's callbacked to from the deferred
+            # returned by ``txrecaptcha.submit``, the latter of which would
+            # require networking (as well as automated CAPTCHA
+            # breaking). Hence, the 'no cover' pragma.
             if solution.is_valid:  # pragma: no cover
                 logging.info("Valid CAPTCHA solution from %r."
                              % Util.logSafely(clientIP))





More information about the tor-commits mailing list