changeset 59:0af1f4ae328d

fix a couple of basic things
author egj@socialplanning.org
date Mon, 04 Jan 2010 03:12:04 +0000
parents b97d11e2cf41
children 94dddb3a5d77
files bitsyblog/bitsyblog.py bitsyblog/factory.py bitsyblog/roles.py bitsyblog/user.py
diffstat 4 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sun Dec 27 01:25:38 2009 -0500
+++ b/bitsyblog/bitsyblog.py	Mon Jan 04 03:12:04 2010 +0000
@@ -6,11 +6,6 @@
 
 ### global variables
 
-# who can view which blog posts
-roles = { 'public': ( 'public', ),
-          'friend': ( 'public', 'secret' ),
-          'author': ( 'public', 'secret', 'private' ), }
-
 ### imports
 
 import dateutil.parser
@@ -35,9 +30,10 @@
 from pkg_resources import resource_filename
 from StringIO import StringIO
 from urlparse import urlparse
-from user import FilespaceUsers
 from webob import Request, Response, exc
 
+from roles import roles
+
 ### exceptions
 
 class BlogPathException(Exception):
@@ -74,6 +70,8 @@
                                     }
         
         # abstract attributes
+        from user import FilespaceUsers
+
         self.users = FilespaceUsers(self.file_dir)
         self.blog = FileBlog(self.file_dir)
         self.cooker = self.restructuredText
--- a/bitsyblog/factory.py	Sun Dec 27 01:25:38 2009 -0500
+++ b/bitsyblog/factory.py	Mon Jan 04 03:12:04 2010 +0000
@@ -20,7 +20,12 @@
                   if app_conf.has_key(key_str % key) ])
     app = BitsyBlog(**args)
     secret = app_conf.get('secret', 'secret')
-    return BitsyAuth(HTTPExceptionHandler(app), global_conf, app.passwords, app.newuser, 'bitsyblog', secret)
+    return BitsyAuth(HTTPExceptionHandler(app), 
+                     global_conf,
+                     app.passwords,
+                     app.newuser,
+                     'bitsyblog', 
+                     secret)
 
 
 def bitsierfactory(global_conf, **app_conf):
@@ -32,7 +37,12 @@
     app = BitsierBlog(**args)
     app.user = user
     secret = app_conf.get('secret', 'secret')
-    auth = BitsyAuth(HTTPExceptionHandler(app), global_conf, app.passwords, newuser=None, site='bitsyblog', secret=secret)
+    auth = BitsyAuth(HTTPExceptionHandler(app),
+                     global_conf,
+                     app.passwords,
+                     newuser=None,
+                     site=app_conf.get('site', 'bitsyblog'),
+                     secret=secret)
     if not user in app.users:
         pw = getpass('Enter password for %s: ' % user)
         app.newuser(user, auth.hash(app.user, pw))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bitsyblog/roles.py	Mon Jan 04 03:12:04 2010 +0000
@@ -0,0 +1,5 @@
+
+# who can view which blog posts
+roles = { 'public': ( 'public', ),
+          'friend': ( 'public', 'secret' ),
+          'author': ( 'public', 'secret', 'private' ), }
--- a/bitsyblog/user.py	Sun Dec 27 01:25:38 2009 -0500
+++ b/bitsyblog/user.py	Mon Jan 04 03:12:04 2010 +0000
@@ -2,7 +2,7 @@
 import random
 import settings
 import shutil
-from bitsyblog import roles
+from roles import roles
 from webob import exc
 
 class BitsyUser(object):
@@ -44,7 +44,6 @@
         return passwords
 
     ### interface methods to be specified by the child class
-
     def new(self, name, password):
         """create a new user"""