# HG changeset patch # User egj@socialplanning.org # Date 1262574724 0 # Node ID 0af1f4ae328d45596ea6406a5ba01a4b34102d74 # Parent b97d11e2cf414a1e6f239d5b0c3046c2e2a6ce54 fix a couple of basic things diff -r b97d11e2cf41 -r 0af1f4ae328d bitsyblog/bitsyblog.py --- 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 diff -r b97d11e2cf41 -r 0af1f4ae328d bitsyblog/factory.py --- 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)) diff -r b97d11e2cf41 -r 0af1f4ae328d bitsyblog/roles.py --- /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' ), } diff -r b97d11e2cf41 -r 0af1f4ae328d bitsyblog/user.py --- 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"""