changeset 52:aabc968611bc

STUB: bitsyauth/__init__.py
author Jeff Hammel <k0scist@gmail.com>
date Sun, 23 Feb 2014 17:08:13 -0800
parents 12342551537b
children d9e712cfd098
files bitsyauth/__init__.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyauth/__init__.py
+++ b/bitsyauth/__init__.py
@@ -1,8 +1,12 @@
+"""
+bitsyauth: wrapper module for paste auth
+"""
+
 import markup
 import random
 import re
 import sys
 
 from cStringIO import StringIO
 from markup.form import Form
 from paste.auth import basic, cookie, digest, form, multi, auth_tkt
@@ -24,16 +28,17 @@ def random_word():
         # XXX could use a backup dictionary
         _dictionary = file(dictionary_file).readlines()
         _dictionary = [ i.strip() for i in _dictionary ]
         _dictionary = [ i.lower() for i in _dictionary
                         if i.isalpha() and i > min_length ]
         globals()['dictionary'] = _dictionary
     return random.Random().choice(dictionary)
 
+
 class BitsyAuthInnerWare(object):
     """inner auth;  does login checking"""
 
     def __init__(self, app, passwords, newuser=None, site=None, realm=None):
         """
         a simple auth implementation: inner middleware
 
         * app: the WSGI app to be wrapped
@@ -232,16 +237,17 @@ class BitsyAuthInnerWare(object):
             error = True
         else:
             error = not self.authfunc(self.request.environ, user, password)
         if error:
             return { 'Name': 'Wrong username or password' }
         self.request.environ['REMOTE_USER'] = user
         self.request.environ['paste.auth_tkt.set_user'](user)
 
+
     ### join
 
     def captcha_pre(self, word, key):
         """CAPTCHA with pre-formatted text"""
         return skimpyAPI.Pre(word, scale=1.2).data()
 
     def captcha_png(self, word, key):
         """CAPTCHA with a PNG image"""