[tor-commits] [bridgedb/master] Condense single use ReCaptchaKeyError exception message.

isis at torproject.org isis at torproject.org
Sun Mar 16 19:04:58 UTC 2014


commit 0bc9584bf1c9868b701a3fee63832a08ad4718d8
Author: Isis Lovecruft <isis at torproject.org>
Date:   Tue Mar 11 20:48:05 2014 +0000

    Condense single use ReCaptchaKeyError exception message.
    
    It's only used once, we may just as well initialise it in that one place
    with that message and remove the __init__ constructor from the exception
    class.
---
 lib/bridgedb/captcha.py |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/bridgedb/captcha.py b/lib/bridgedb/captcha.py
index 2e175f8..608882a 100644
--- a/lib/bridgedb/captcha.py
+++ b/lib/bridgedb/captcha.py
@@ -46,10 +46,6 @@ from zope.interface import Interface, Attribute, implements
 class ReCaptchaKeyError(Exception):
     """Exception raised when recaptcha API keys are not supplied."""
 
-    def __init__(self):
-        msg = 'You must supply recaptcha API keys'
-        Exception.__init__(self, msg)
-
 class GimpCaptchaError(Exception):
     """General exception raised when a Gimp CAPTCHA cannot be retrieved."""
 
@@ -96,7 +92,7 @@ class ReCaptcha(Captcha):
         ``ReCaptcha.challenge``.
         """
         if not self.pubkey or not self.privkey:
-            raise ReCaptchaKeyError
+            raise ReCaptchaKeyError('You must supply recaptcha API keys')
 
         urlbase = API_SSL_SERVER
         form = "/noscript?k=%s" % self.pubkey





More information about the tor-commits mailing list