constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/
commit 757adaf6f3b2b20885a445eb73385976fe62d3d5
parent 6083eb61738d1111b46e2f53462ea8c86d28d652
Author: Dan Callaghan <djc@djc.id.au>
Date:   Wed,  3 Sep 2008 10:55:12 +1000

we shouldn't be generating GUIDs on the fly, they are supposed to be persistent

Diffstat:
Mblog.py | 10++--------
Mtemplates/multiple_atom.xml | 2+-
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/blog.py b/blog.py
@@ -98,7 +98,7 @@ class Entry(object):
 
         self.modified_date = datetime.fromtimestamp(os.path.getmtime(os.path.join(self.dir, 'content.txt')))
         self.publication_date = self.metadata.get('publication-date', None) or self.modified_date
-        self._guid = self.metadata.get('guid', None)
+        self.guid = self.metadata['guid']
 
     def comments(self):
         return Comments(self.comments_dir)
@@ -111,9 +111,6 @@ class Entry(object):
         return os.path.isdir(self.comments_dir) and \
                 os.access(self.comments_dir, os.R_OK)
 
-    def guid(self):
-        return self._guid or u'%s/%s' % (config.ABS_BASE, self.id)
-
 
 class ReadingLogEntry(object):
 
@@ -126,14 +123,11 @@ class ReadingLogEntry(object):
         self.isbn = yaml_dict.get('ISBN', None)
         self.rating = yaml_dict.get('Rating', None)
         self.tags = frozenset()
-        self._guid = yaml_dict.get('GUID', None)
+        self.guid = yaml_dict['GUID']
 
     def has_comments(self):
         return False
 
-    def guid(self):
-        return self._guid or u'%s/#post-%s' % (config.ABS_BASE, self.id)
-
 
 class Comments(object):
 
diff --git a/templates/multiple_atom.xml b/templates/multiple_atom.xml
@@ -17,7 +17,7 @@ ATOM_TIME_FORMAT = str('%Y-%m-%dT%H:%M:%S+10:00')
 <updated>${feed_updated.strftime(ATOM_TIME_FORMAT)}</updated>
 
 <entry py:for="entry in sorted_entries">
-	<id>${entry.guid()}</id>
+	<id>${entry.guid}</id>
 	<published>${entry.publication_date.strftime(ATOM_TIME_FORMAT)}</published>
 	<updated>${entry.modified_date.strftime(ATOM_TIME_FORMAT)}</updated>
 	<author>