diff options
author | Nitzo <nitzo2001@yahoo.com> | 2016-02-27 18:01:32 +0100 |
---|---|---|
committer | Nitzo <nitzo2001@yahoo.com> | 2016-02-27 18:01:32 +0100 |
commit | 2c2b12504fe25885a18ae4ad520add46155572d7 (patch) | |
tree | ab33b440ac9ed6e8e25ac79ba23996f902f9793b /module | |
parent | [ReCaptcha] minor cosmetic change (diff) | |
download | pyload-2c2b12504fe25885a18ae4ad520add46155572d7.tar.xz |
[ReCaptcha] fix #2364
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/captcha/ReCaptcha.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py index 18a0aa4c5..ae243ab67 100644 --- a/module/plugins/captcha/ReCaptcha.py +++ b/module/plugins/captcha/ReCaptcha.py @@ -9,21 +9,27 @@ from StringIO import StringIO from module.plugins.internal.CaptchaService import CaptchaService try: + no_pil = False from PIL import _imaging from PIL import Image from PIL import ImageDraw from PIL import ImageFont + except ImportError: - import _imaging - import Image - import ImageDraw - import ImageFont + try: + import _imaging + import Image + import ImageDraw + import ImageFont + + except ImportError: + no_pil = True class ReCaptcha(CaptchaService): __name__ = 'ReCaptcha' __type__ = 'captcha' - __version__ = '0.23' + __version__ = '0.24' __status__ = 'testing' __description__ = 'ReCaptcha captcha service plugin' @@ -120,6 +126,10 @@ class ReCaptcha(CaptchaService): def _prepare_image(self, image, challenge_msg): + if no_pil: + self.log_error(_("Missing PIL lib"), _("Please install python's PIL library")) + self.fail(_("Missing PIL lib")) + dummy_text = 'pk' # This is just a string to calculate biggest height of a text, since usually # the letters 'p' and 'k' reach to the lower most respective higher most @@ -208,7 +218,7 @@ class ReCaptcha(CaptchaService): def _challenge_v2(self, key): fallback_url = 'http://www.google.com/recaptcha/api/fallback?k=' + key - html = self.pyfile.plugin.load(fallback_url) + html = self.pyfile.plugin.load(fallback_url, ref=self.pyfile.url) for i in xrange(10): try: |