constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/
commit ac25f3317fba9676e75924a97dd9f5e66f090931
parent 9307ec78336d3c616941c46e4f262119c0f5fca9
Author: Dan Callaghan <djc@djc.id.au>
Date:   Wed, 19 Nov 2008 20:06:53 +1000

Automated merge with http://source.sjkwi.com.au/hg/constance

Diffstat:
Mapp.py | 4++--
Mblog.py | 5+++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app.py b/app.py
@@ -74,8 +74,8 @@ class Constance(object):
                               v.decode(self.encoding, 'ignore')) 
                              for k, v in cgi.parse_qsl(self.post_data, True))
 
-        self.blog_entries = blog.BlogEntrySet(self.config.getunicode('blog', 'dir'))
-        readinglog_filename = self.config.getunicode('readinglog', 'filename')
+        self.blog_entries = blog.BlogEntrySet(self.config.get('blog', 'dir'))
+        readinglog_filename = self.config.get('readinglog', 'filename')
         if readinglog_filename:
             self.readinglog_entries = blog.ReadingLogEntrySet(readinglog_filename)
         else:
diff --git a/blog.py b/blog.py
@@ -65,6 +65,7 @@ class DirectoryEntrySet(object):
                 if not filename.startswith('.'))
 
     def __iter__(self):
+        assert isinstance(self.base_dir, str)
         return (self.entry_class(self.base_dir, filename)
                 for filename in os.listdir(self.base_dir)
                 if not filename.startswith('.'))
@@ -84,8 +85,8 @@ class YamlEntrySet(object):
 class BlogEntry(object):
 
     def __init__(self, entries_dir, id):
-        assert isinstance(id, unicode), id
-        self.id = id
+        assert isinstance(id, str), id
+        self.id = id.decode('utf8') # XXX shouldn't hardcode the encoding
         self.dir = os.path.join(entries_dir, id)
         self.comments_dir = os.path.join(self.dir, 'comments')