changeset 103:62d4deec4314

STUB: bitsyblog/factory.py
author Jeff Hammel <k0scist@gmail.com>
date Sun, 23 Feb 2014 17:09:22 -0800
parents bc08a00a7d93
children 3198edbf7d8e
files bitsyblog/factory.py
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/factory.py	Sun Feb 23 16:50:06 2014 -0800
+++ b/bitsyblog/factory.py	Sun Feb 23 17:09:22 2014 -0800
@@ -1,6 +1,10 @@
+"""
+factories for bistyblog
+"""
+
 from bitsyauth import BitsyAuth
 from bitsyblog import BitsyBlog, BitsierBlog
-from getpass import getpass 
+from getpass import getpass
 from paste.httpexceptions import HTTPExceptionHandler
 
 def get_args(app_conf, app=BitsyBlog):
@@ -8,7 +12,6 @@
 
     # accepted configuration keys, e.g. 'bitsyblog.file_dir'
     config = set(app.defaults.keys())
-    
     key_str = app_conf.get('namespace', 'bitsyblog.')
     bitsyblog_args = {}
     handler_args = {}
@@ -26,19 +29,24 @@
             handler_args.setdefault(section, {})[key] = value
     return bitsyblog_args, handler_args
 
+
 def factory(global_conf, **app_conf):
     """make bitsyauth app and wrap it in middleware"""
+
     bitsyblog_args, handler_args = get_args(app_conf)
     app = BitsyBlog(bitsyblog_args, handler_args)
     secret = app_conf.get('secret', 'secret')
-    return BitsyAuth(HTTPExceptionHandler(app), 
+    return BitsyAuth(HTTPExceptionHandler(app),
                      global_conf,
                      app.passwords,
                      app.newuser,
-                     'bitsyblog', 
+                     'bitsyblog',
                      secret)
 
+
 def basebitsierfactory(global_conf, bitsyblog_args, handler_args):
+    """make single-user bitsyblog, base function"""
+
     user = bitsyblog_args['user'] # ensure this exists
     app = BitsierBlog(bitsyblog_args, handler_args)
     secret = bitsyblog_args.get('secret', 'secret')