changeset 54:b39ab92955ef

allow StringIO not just cStringIO
author Jeff Hammel <k0scist@gmail.com>
date Tue, 03 Nov 2020 12:55:30 -0800
parents d9e712cfd098
children 8367a345ae41
files bitsyauth/__init__.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyauth/__init__.py	Thu Mar 06 22:27:26 2014 -0800
+++ b/bitsyauth/__init__.py	Tue Nov 03 12:55:30 2020 -0800
@@ -7,12 +7,16 @@
 import re
 import sys
 
-from cStringIO import StringIO
 from markup.form import Form
 from paste.auth import basic, cookie, digest, form, multi, auth_tkt
 from webob import Request, Response, exc
 
 try:
+    from cStringIO import StringIO
+except ImportError:
+    from StringIO import StringIO
+
+try:
     from skimpyGimpy import skimpyAPI
     CAPTCHA = True
 except ImportError:
@@ -20,6 +24,7 @@
 
 dictionary_file = '/usr/share/dict/american-english'
 
+
 def random_word():
     """generate a random word for CAPTCHA auth"""
     min_length = 5 # minimum word length
@@ -97,7 +102,6 @@
             except Exception as e:
                 print (e)
                 raise
-                import pdb; pdb.set_trace()
 
         # digest auth
         if 'Authorization' in self.request.headers.keys():
@@ -391,4 +395,3 @@
         res.delete_cookie(self.cookie)
         res.unset_cookie(self.cookie)
         return res(environ, start_response)
-