changeset 100:f2780e1418bb

STUB: bitsyblog/bitsyblog.py
author Jeff Hammel <k0scist@gmail.com>
date Thu, 30 Jan 2014 19:51:19 -0800
parents 8d8f639d563f
children 83ec14fca36c
files bitsyblog/bitsyblog.py
diffstat 1 files changed, 10 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sat Nov 30 18:03:02 2013 -0800
+++ b/bitsyblog/bitsyblog.py	Thu Jan 30 19:51:19 2014 -0800
@@ -5,7 +5,6 @@
 """
 
 ### imports
-
 import dateutil.parser
 
 import datetime
@@ -15,10 +14,9 @@
 import os
 import PyRSS2Gen
 import re
-
-import utils
-
-from blog import FileBlog
+import .utils
+from .blog import FileBlog
+from .roles import roles
 from cStringIO import StringIO
 from docutils.utils import SystemMessage
 from genshi.builder import Markup
@@ -30,7 +28,6 @@
 from urlparse import urlparse
 from webob import Request, Response, exc
 
-from roles import roles
 
 ### exceptions
 
@@ -197,9 +194,7 @@
     def get_user_space(self, user, path, request):
         """returns a part of the user space"""
 
-#        request.user = self.users[user] # user whose blog is viewed
         check = self.check_user(user, request) # is this the authenticated user?
-
         feed = None # not an rss/atom feed by default (flag)
         n_posts = self.number_of_posts(request, user)
         n_links = self.number_of_links(request, n_posts, user)
@@ -215,17 +210,10 @@
                 return check
             return Response(content_type='text/html', body=self.preferences(request, user))
 
-        if path == [ 'rss' ]:
-            feed = 'rss'
-            path = []
-            if n_posts is None:
-                n_posts = self.feed_items # TODO: allow to be configurable
-
-        if path == [ 'atom' ]:
-            feed = 'atom'
-            path = []
-            if n_posts is None:
-                n_posts = self.feed_items # TODO: allow to be configurable
+        if path in (['atom'], ['rss']):
+            # feeds
+            feed = path.pop()
+            n_posts = n_posts or self.feed_items
 
         if len(path) == 2:
             if path[0] == 'css':
@@ -279,10 +267,11 @@
         if index is not None:
             return index
 
-        ### user space
+        # user space
         user, path = self.userpath(request)
         return self.get_user_space(user, path, request)
 
+
     ## POST
 
     def post(self, request):
@@ -352,7 +341,7 @@
         for handler in self.handlers:
           try:
             handler(blog_entry, location)
-          except:
+          except: # XXX bare except!
             pass
 
         # point the user at the post