changeset 105:67e01fc5e360

STUB: bitsyblog/bitsyblog.py bitsyblog/factory.py bitsyblog/user.py
author Jeff Hammel <k0scist@gmail.com>
date Sun, 23 Feb 2014 17:45:22 -0800
parents 3198edbf7d8e
children c7495fb71045
files bitsyblog/bitsyblog.py bitsyblog/factory.py bitsyblog/user.py
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sun Feb 23 17:16:09 2014 -0800
+++ b/bitsyblog/bitsyblog.py	Sun Feb 23 17:45:22 2014 -0800
@@ -254,9 +254,7 @@
         return Response(content_type=content_type, body=content)
 
     def get(self, request):
-        """
-        respond to a get request
-        """
+        """respond to a get request"""
 
         # front matter of the site
         index = self.get_index(request)
@@ -337,8 +335,8 @@
         for handler in self.handlers:
           try:
             handler(blog_entry, location)
-          except: # XXX bare except!
-            pass
+          except Exception as e: # XXX bare except!
+              print ("Error processing {}: {}".format(handler, e))
 
         # point the user at the post
         return exc.HTTPSeeOther("Post blogged by bitsy", location=location)
@@ -572,7 +570,7 @@
                           (self.user_url(request, user, 'preferences'), 'preferences'),
                           (self.link(request, 'logout'), 'logout')])
         else:
-            links.extend([(self.link(request, 'login'), 'login'), 
+            links.extend([(self.link(request, 'login'), 'login'),
                           (self.link(request, 'join'), 'join')])
 
         if hasattr(self, 'help'):
--- a/bitsyblog/factory.py	Sun Feb 23 17:16:09 2014 -0800
+++ b/bitsyblog/factory.py	Sun Feb 23 17:45:22 2014 -0800
@@ -57,6 +57,8 @@
                      site=bitsyblog_args.get('site', 'bitsyblog'),
                      secret=secret)
     if not user in app.users:
+        # create a new user
+        # really, should go in CLI or what not
         pw = getpass('Enter password for %s: ' % user)
         app.newuser(user, auth.hash(app.user, pw))
     return auth
--- a/bitsyblog/user.py	Sun Feb 23 17:16:09 2014 -0800
+++ b/bitsyblog/user.py	Sun Feb 23 17:45:22 2014 -0800
@@ -36,7 +36,7 @@
     def __getitem__(self, user):
         """return a user"""
         if user not in self.users():
-            raise KeyError
+            raise KeyError("User '{}' not found".format(user))
         user = BitsyUser(user, self.password(user))
         user.settings = self.settings(user.name)
         return user