From dcb1894e0c708df0677187355c6743c08ac44c26 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 31 May 2011 20:36:19 +0200 Subject: fixed positional captchas + availbillity over thrift --- module/CaptchaManager.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'module/CaptchaManager.py') diff --git a/module/CaptchaManager.py b/module/CaptchaManager.py index 539e80744..02cd10a11 100644 --- a/module/CaptchaManager.py +++ b/module/CaptchaManager.py @@ -99,9 +99,9 @@ class CaptchaTask(): return self.captchaImg, self.captchaFormat, self.captchaResultType def setResult(self, text): - if self.captchaResultType == 'textual': + if self.isTextual(): self.result = text - if self.captchaResultType == 'positional': + if self.isPositional(): try: parts = text.split(',') self.result = (int(parts[0]), int(parts[1])) @@ -130,6 +130,14 @@ class CaptchaTask(): return True + def isTextual(self): + """ returns if text is written on the captcha """ + return self.captchaResultType == 'textual' + + def isPositional(self): + """ returns if user have to click a specific region on the captcha """ + return self.captchaResultType == 'positional' + def setWatingForUser(self, exclusive): if exclusive: self.status = "user" -- cgit v1.2.3