changeset 87:67dd8e0aa6da

whitespace
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 17 Nov 2011 15:03:19 -0800
parents 777c47bae0ab
children a3a7ac9102dc
files bitsyblog/bitsyblog.py
diffstat 1 files changed, 17 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Thu Nov 17 13:26:24 2011 -0800
+++ b/bitsyblog/bitsyblog.py	Thu Nov 17 15:03:19 2011 -0800
@@ -62,10 +62,10 @@
         for key in self.defaults:
             setattr(self, key, kw.get(key, self.defaults[key]))
         self.n_links = int(self.n_links) # could be a string from the .ini
-        self.response_functions = { 'GET': self.get,
-                                    'POST': self.post,
-                                    'PUT': self.put
-                                    }
+        self.response_functions = {'GET': self.get,
+                                   'POST': self.post,
+                                   'PUT': self.put
+                                   }
 
         # abstract attributes
         from user import FilespaceUsers
@@ -111,7 +111,7 @@
                   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
                   raise
 
     ### methods dealing with HTTP
@@ -361,7 +361,7 @@
 
         if len(path):
             return exc.HTTPMethodNotAllowed("Not sure what you're trying to do")
-        
+
         # find the dates + entries in the file
         regex = '\[.*\]:'
         entries = re.split(regex, request.body)[1:]
@@ -373,14 +373,14 @@
         for i in range(len(entries)):
             datestamp = utils.datestamp(dates[i])
             self.blog.post(user, datestamp, entries[i], 'public')
-        
+
         return exc.HTTPOk("%s posts blogged" % len(entries))
 
 
     def error(self):
         """deal with non-supported methods"""
-        methods = ', '.join(self.response_functions.keys()[:1]) 
-        methods += ' and %s' % self.response_functions.keys()[-1] 
+        methods = ', '.join(self.response_functions.keys()[:1])
+        methods += ' and %s' % self.response_functions.keys()[-1]
         return exc.HTTPMethodNotAllowed("Only %s operations are allowed" % methods)
 
     ### auth/auth functions
@@ -390,7 +390,6 @@
 
     def authenticated(self, request):
         """return authenticated user"""
-        # XXX needed? 
         return request.environ.get('REMOTE_USER')
 
     def check_user(self, user, request):
@@ -402,7 +401,7 @@
         if authenticated is None:
             return exc.HTTPUnauthorized('Unauthorized')
         elif user != authenticated:
-            return exc.HTTPForbidden("Forbidden")        
+            return exc.HTTPForbidden("Forbidden")
 
     def role(self, user, request):
         """
@@ -423,7 +422,7 @@
     ### user methods
 
     def userpath(self, request):
-        """user who's blog one is viewing"""        
+        """user who's blog one is viewing"""
         path = request.path_info.strip('/').split('/')
         name = path[0]
         path = path[1:]
@@ -472,14 +471,14 @@
             value = int(url, 16)
         except ValueError:
             return None
-        
+
         # XXX once one has a mangled url, one can obtain the secret
-        value /= self.users.secret(user) 
+        value /= self.users.secret(user)
 
         entry = str(value)
         if self.isentry(entry):
             return self.blog.entry(user, entry, ['public', 'secret', 'private'])
-        
+
     ### blog retrival methods
 
     def isentry(self, string): # TODO -> blog.py
@@ -522,21 +521,21 @@
         if not path:
             return self.blog(user, allowed, n_items)
 
-        # mangled urls 
+        # mangled urls
         if len(path) == 1 and path[0].startswith('x'):
             entry = self.unmangleurl(path[0], user)
             if entry:
                 return [ entry ]
             else:
                 raise BlogPathException(notfound)
-            
+
         # individual blog entry
         if (len(path) == 1) and self.isentry(path[0]):
             blog = self.blog.entry(user, path[0], allowed)
             if not blog:
                 raise BlogPathException(notfound)
             return [ blog ]
-            
+
         # parse the path into a date path
         n_date_vals = 3 # year, month, date
         if len(path) > n_date_vals: