commit 1cadbf4de48d827e094d905065c197a4ca1184ab Author: Isis Lovecruft isis@torproject.org Date: Fri Feb 28 02:47:33 2014 +0000
Rename reCaptcha classes.
* RENAME captcha.Raptcha → captcha.ReCaptcha * RENAME captcha.RaptchaKeyError → captcha.ReCaptchaKeyError --- lib/bridgedb/HTTPServer.py | 4 ++-- lib/bridgedb/captcha.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/bridgedb/HTTPServer.py b/lib/bridgedb/HTTPServer.py index 175fd24..2d5fd72 100644 --- a/lib/bridgedb/HTTPServer.py +++ b/lib/bridgedb/HTTPServer.py @@ -27,7 +27,7 @@ import bridgedb.I18n as I18n import bridgedb.Util as Util
from recaptcha.client import captcha as recaptcha -from bridgedb.captcha import Raptcha +from bridgedb.captcha import ReCaptcha from bridgedb.Filters import filterBridgesByIP6, filterBridgesByIP4 from bridgedb.Filters import filterBridgesByTransport from bridgedb.Filters import filterBridgesByNotBlockedIn @@ -144,7 +144,7 @@ class CaptchaProtectedResource(twisted.web.resource.Resource): :returns: A rendered HTML page containing a ReCaptcha challenge image for the client to solve. """ - c = Raptcha(self.recaptchaPubKey, self.recaptchaPrivKey) + c = ReCaptcha(self.recaptchaPubKey, self.recaptchaPrivKey)
try: c.get() diff --git a/lib/bridgedb/captcha.py b/lib/bridgedb/captcha.py index 0d3bf35..430643c 100644 --- a/lib/bridgedb/captcha.py +++ b/lib/bridgedb/captcha.py @@ -19,8 +19,8 @@
.. captcha - |_RaptchaKeyError - _Raptcha - Class for obtaining reCaptcha images and challenge strings + |_ReCaptchaKeyError + _ReCaptcha - Class for obtaining reCaptcha images and challenge strings ..
There are two types of CAPTCHAs which BridgeDB knows how to serve: those @@ -38,7 +38,7 @@ from BeautifulSoup import BeautifulSoup from recaptcha.client import captcha as recaptcha
-class Raptcha(object): +class ReCaptcha(object): """ A recaptcha captcha and method to request them """
def __init__(self, pubkey=None, privkey=None): @@ -51,7 +51,7 @@ class Raptcha(object): """ gets a fresh captcha """
if (self.pubkey == '') or (self.privkey == ''): - raise RaptchaKeyError + raise ReCaptchaKeyError urlbase = recaptcha.API_SERVER form = "/noscript?k=%s" % self.pubkey
@@ -62,7 +62,7 @@ class Raptcha(object): self.challenge = str(soup.find('input', {'name' : 'recaptcha_challenge_field'})['value']) self.image = urllib2.urlopen(imgurl).read()
-class RaptchaKeyError(Exception): +class ReCaptchaKeyError(Exception): """ Exception raised when recaptcha API keys are not supplied""" def __init__(self): msg = 'You must supply recaptcha API keys'
tor-commits@lists.torproject.org