changeset 94:fa221a2d24d9

wow; old + crufty
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 24 Apr 2013 09:07:15 -0700
parents 5c04cf601aba
children dd4abe56edf7
files bitsyblog/bitsyblog.py bitsyblog/cli.py bitsyblog/user.py
diffstat 3 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sun Feb 17 18:51:55 2013 -0800
+++ b/bitsyblog/bitsyblog.py	Wed Apr 24 09:07:15 2013 -0700
@@ -799,7 +799,7 @@
         # render the template
         template = self.loader.load('preferences.html')
         return template.generate(**data).render()
-            
+
 
 class BitsierBlog(BitsyBlog):
     """single user version of bitsyblog"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bitsyblog/cli.py	Wed Apr 24 09:07:15 2013 -0700
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+"""
+command line interface to bitsyblog
+"""
--- a/bitsyblog/user.py	Sun Feb 17 18:51:55 2013 -0800
+++ b/bitsyblog/user.py	Wed Apr 24 09:07:15 2013 -0700
@@ -7,7 +7,7 @@
 
 class BitsyUser(object):
     """interface class for a bitsyblog user"""
-    settings = {} 
+    settings = {}
     def __init__(self, name, password=''):
         self.name = name
         self.password = password
@@ -39,7 +39,7 @@
     def passwords(self):
         """returns a dictionary of { user: password }"""
         passwords = {}
-        for user in self.users():            
+        for user in self.users():
             passwords[user] = self.password(user)
         return passwords
 
@@ -124,13 +124,13 @@
         print >> pw_file, password
 
         # setup entries structure for blog
-        entries = os.path.join(home, 'entries') 
+        entries = os.path.join(home, 'entries')
         os.mkdir(entries)
         for setting in roles['author']:
             os.mkdir(os.path.join(entries, setting))
 
         # setup user CSS
-        css_dir = os.path.join(home, 'css') 
+        css_dir = os.path.join(home, 'css')
         os.mkdir(css_dir)
         shutil.copyfile(os.path.join(self.directory, 'site.css'),
                         os.path.join(css_dir, 'default.css'))
@@ -159,7 +159,7 @@
         if os.path.exists(filename):
             prefs = file(filename).read().split('\n')
             prefs = [ i for i in prefs if i.strip() ]
-            prefs = [ [ j.strip() for j in i.split(':', 1) ] 
+            prefs = [ [ j.strip() for j in i.split(':', 1) ]
                       for i in prefs if ':' in i]
             prefs = dict(prefs)
 
@@ -172,14 +172,13 @@
 
         # CSS files
         prefs['CSS'] = self.css(name, prefs.get('Stylesheet'))
-        
+
         return prefs
 
     def write_settings(self, name, **kw):
         """write user settings to disk"""
-        
+
         # generic stuff; could factor out
-        
         newsettings = {}
         errors = {}
 
@@ -202,7 +201,7 @@
             css_file = file(self.home(name, 'css', filename), 'w')
             print >> css_file, new_css['css']
             newsettings['CSS'] = filename.rsplit('.css', 1)[0]
-                
+
         prefs = self.settings(name)
         prefs.update(newsettings)