Commit 33bb8117 authored by Aurel's avatar Aurel

whitespace cleanup

parent f98d2752
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Python module for easy utilization of http://captchas.net # Python module for easy utilization of http://captchas.net
# #
# For documentation look at http://captchas.net/sample/python/ # For documentation look at http://captchas.net/sample/python/
# #
# Written by Sebastian Wilhelmi <seppi@seppi.de> and # Written by Sebastian Wilhelmi <seppi@seppi.de> and
# Felix Holderied <felix@holderied.de> # Felix Holderied <felix@holderied.de>
# This file is in the public domain. # This file is in the public domain.
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
# 2010-01-15: Adapt to ERP5 : a lot of code had to be removed or changed. # 2010-01-15: Adapt to ERP5 : a lot of code had to be removed or changed.
# Most of the work must be done in another class. # Most of the work must be done in another class.
# #
# 2006-09-08: Add new optional parameters alphabet, letters # 2006-09-08: Add new optional parameters alphabet, letters
# height an width. Add audio_url. # height an width. Add audio_url.
# #
# 2006-03-01: Only delete the random string from the repository in # 2006-03-01: Only delete the random string from the repository in
# case of a successful verification. # case of a successful verification.
# #
...@@ -63,7 +63,7 @@ class CaptchasDotNet: ...@@ -63,7 +63,7 @@ class CaptchasDotNet:
# Return the random string. # Return the random string.
return random_string return random_string
def image_url (self, random, base = 'image.captchas.net/'): def image_url (self, random, base = 'image.captchas.net/'):
url = '%s://%s?client=%s&amp;random=%s' % (self.__protocol,base,self.__client,random) url = '%s://%s?client=%s&amp;random=%s' % (self.__protocol,base,self.__client,random)
if self.__alphabet != "abcdefghijklmnopqrstuvwxyz": if self.__alphabet != "abcdefghijklmnopqrstuvwxyz":
url += '&amp;alphabet=%s' % self.__alphabet url += '&amp;alphabet=%s' % self.__alphabet
...@@ -91,10 +91,10 @@ class CaptchasDotNet: ...@@ -91,10 +91,10 @@ class CaptchasDotNet:
alt="The CAPTCHA image" /></a> alt="The CAPTCHA image" /></a>
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
function captchas_image_error (image) function captchas_image_error (image)
{ {
if (!image.timeout) return true; if (!image.timeout) return true;
image.src = image.src.replace (/^%(protocol)s:\/\/image\.captchas\.net/, image.src = image.src.replace (/^%(protocol)s:\/\/image\.captchas\.net/,
'%(protocol)s://image.backup.captchas.net'); '%(protocol)s://image.backup.captchas.net');
return captchas_image_loaded (image); return captchas_image_loaded (image);
} }
...@@ -114,13 +114,13 @@ class CaptchasDotNet: ...@@ -114,13 +114,13 @@ class CaptchasDotNet:
"captchas_image_error (document.getElementById ('%(id)s'))", "captchas_image_error (document.getElementById ('%(id)s'))",
10000); 10000);
image.src = image.src; image.src = image.src;
//--> //-->
</script>''' % ( {'id':id, </script>''' % ( {'id':id,
'source': self.image_url(random), 'source': self.image_url(random),
'width': self.__width, 'width': self.__width,
'height': self.__height, 'height': self.__height,
'protocol': self.__protocol}) 'protocol': self.__protocol})
def get_answer (self, random ): def get_answer (self, random ):
# The format of the password. # The format of the password.
password_alphabet = self.__alphabet password_alphabet = self.__alphabet
...@@ -138,5 +138,5 @@ class CaptchasDotNet: ...@@ -138,5 +138,5 @@ class CaptchasDotNet:
for pos in range (password_length): for pos in range (password_length):
letter_num = ord (digest[pos]) % len (password_alphabet) letter_num = ord (digest[pos]) % len (password_alphabet)
correct_password += password_alphabet[letter_num] correct_password += password_alphabet[letter_num]
return correct_password return correct_password
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment