changeset 71:0c98d1c2c6df

fix syntax errors
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 08 Jul 2010 10:40:43 -0700
parents f6a6a4b072e7
children c9bab68d00ac
files bitsyblog/bitsyblog.py bitsyblog/blog.py bitsyblog/factory.py
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py
+++ b/bitsyblog/bitsyblog.py
@@ -22,16 +22,17 @@ import re
 import utils 
 
 from blog import FileBlog
 from cStringIO import StringIO
 from docutils.utils import SystemMessage
 from genshi.builder import Markup
 from genshi.template import TemplateLoader
 from paste.fileapp import FileApp
+from pkg_resources import iter_entry_points
 from pkg_resources import resource_filename
 from StringIO import StringIO
 from urlparse import urlparse
 from webob import Request, Response, exc
 
 from roles import roles
 
 ### exceptions
@@ -68,17 +69,17 @@ class BitsyBlog(object):
                                     'POST': self.post,
                                     'PUT': self.put
                                     }
         
         # abstract attributes
         from user import FilespaceUsers
 
         self.users = FilespaceUsers(self.file_dir)
-        self.blog = FileBlog(self, self.file_dir)
+        self.blog = FileBlog(self.file_dir)
         self.cooker = self.restructuredText
         self.feed_items = int(self.feed_items)
 
         # template renderer
         self.auto_reload = self.auto_reload.lower()=='true'
         self.template_directories = self.template_directories.split() # no spaces in directory names, for now
 
         for directory in self.template_directories:
@@ -107,17 +108,17 @@ class BitsyBlog(object):
 
         # post handlers
         self.handlers = [] # handlers for blog post event
         for entry_point in iter_entry_points('bitsyblog.listeners'):
           try:
               handler = entry_point.load()(self, **handler_args.get(entry_point.name, {}))
               self.handlers.append(handler)
           except:
-              print 'Cant load entry point %s' entry_point.name 
+              print 'Cant load entry point %s' % entry_point.name 
               continue
 
 
     ### methods dealing with HTTP
 
     def __call__(self, environ, start_response):
         request = Request(environ)
 
--- a/bitsyblog/blog.py
+++ b/bitsyblog/blog.py
@@ -74,17 +74,17 @@ class Blog(object):
         """
 
     def entries(self, user, permissions, year=None, month=None, day=None):
         """return entries by date"""
 
 
     def post(self, user, date, text, privacy):
         """post a new blog entry"""
-        return BlogEntry(date, text, privacy, user):
+        return BlogEntry(date, text, privacy, user)
 
     def delete(self, user, datestamp):
         """remove a blog entry"""
 
 class FileBlog(Blog):
     """a blog that lives on the filesystem"""
 
     def __init__(self, directory):
--- a/bitsyblog/factory.py
+++ b/bitsyblog/factory.py
@@ -18,41 +18,41 @@ def get_args(app_conf):
     """return arguments for bitsyblog and its handlers"""
     key_str = 'bitsyblog.'
     bitsyblog_args = {}
     handler_args = {}
     for key, value in app_conf.items():
         if key.startswith(key_str):
             key = key.split(key_str, 1)[-1]
             if key in config:
-                bitysblog_args[key] = value
+                bitsyblog_args[key] = value
         else:
             if '.' in key:
                 section, key = key.split('.', 1)
                 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(**args)
+    app = BitsyBlog(bitsyblog_args, handler_args)
     secret = app_conf.get('secret', 'secret')
     return BitsyAuth(HTTPExceptionHandler(app), 
                      global_conf,
                      app.passwords,
                      app.newuser,
                      'bitsyblog', 
                      secret)
 
 
 def bitsierfactory(global_conf, **app_conf):
     """make single-user bitsyblog"""
     bitsyblog_args, handler_args = get_args(app_conf)
     user = app_conf['bitsyblog.user'] # ensure this exist
-    app = BitsierBlog(**args)
+    app = BitsierBlog(bitsyblog_args, handler_args)
     app.user = user
     secret = app_conf.get('secret', 'secret')
     auth = BitsyAuth(HTTPExceptionHandler(app),
                      global_conf,
                      app.passwords,
                      newuser=None,
                      site=app_conf.get('site', 'bitsyblog'),
                      secret=secret)