valid rss and atom feeds
M muyhomepage2/app/configuration.py +3 -0
@@ 64,3 64,6 @@ class Config(object):
     def site_atom_id(self):
         return 'tag:asynchrono.us,2006-01-02:birch-street-computing'
 
+    def atom_id_base(self):
+        return 'tag:asynchrono.us'
+

          
M muyhomepage2/pagehandlers/feeds.py +20 -4
@@ 8,9 8,21 @@ from muyhomepage2 import util
 
 
 class FeedEntryHandler(standard.StandardHandler):
-    pass
-    # linkto
-    # id_tag
+    def __init__(self, config, pg):
+        if not hasattr(pg, 'body'):
+            pg = page.parse(pg.filename)
+        standard.StandardHandler.__init__(self, pg)
+        self.config = config
+
+    def link_ref(self):
+        link = os.path.join(self.config.base_url(), self.finalname())
+        return link
+
+    @property
+    def id_tag(self):
+        return util.atom_id(self.config.atom_id_base(),
+                self.page.created(),
+                self.page.title)
 
 
 class BaseFeedHandler(handler.PageHandler):

          
@@ 22,7 34,11 @@ class BaseFeedHandler(handler.PageHandle
         return self.content()
 
     def _getentries(self, website, config):
-        return []
+        wrap = lambda e: FeedEntryHandler(config, e)
+        entries = []
+        for entry in website.newest(config.feed_count()):
+            entries.append(wrap(entry))
+        return entries
 
     def extension(self, website, config):
         site_url = config.base_url()

          
M muyhomepage2/util.py +9 -1
@@ 77,7 77,13 @@ class When(object):
         return time.strftime(TIME_FMT_MUY, self.utc())
 
     def dayfmt(self):
-        return time.strftime(TIME_FMT_ATOMID, self.local())
+        return time.strftime(TIME_FMT_ATOMID, self.utc())
+
+    def atomfmt(self):
+        return time.strftime(TIME_FMT_3339, self.utc())
+
+    def rfc822fmt(self):
+        return time.strftime(TIME_FMT_822, self.local())
 
     @classmethod
     def parse(cls, txt):

          
@@ 95,3 101,5 @@ class When(object):
     def now(cls):
         return cls(time.time())
 
+def atom_id(base, when, title):
+    return '%s,%s:%s' % (base, when.dayfmt(), encodetitle(title))

          
M skins/default/atom.xml +8 -7
@@ 1,9 1,10 @@ 
 <?xml version="1.0" encoding="utf-8" ?>
 <feed xmlns="http://www.w3.org/2005/Atom">
+
     <title>{{current.page.title}}</title>
     <link href="{{ext.site_url}}"></link>
     <link rel="self" href="{{ext.self_url}}"></link>
-    <updated>{{ext.feed_updated}}</updated>
+    <updated>{{ext.feed_updated.atomfmt()}}</updated>
 
     <author>
         <name>{{ext.feed_author}}</name>

          
@@ 14,13 15,13 @@ 
     {% for entry in ext.entries %}
     <entry>
         <title>{{entry.page.title}}</title>
-        <link href="{{entry.linkto}}"></link>
-        <updated>{{entry.modifiedon.atomfmt}}</updated>
-        <published>{{entry.createdon.atomfmt}}</published>
+        <link href="{{entry.link_ref()}}"></link>
+        <updated>{{entry.modifiedon.atomfmt()}}</updated>
+        <published>{{entry.createdon.atomfmt()}}</published>
 
-        <content type="html">
-            {{entry.content()|e}}
-        </content>
+      <content type="html">
+      {{entry.content()|e}}
+      </content>
 
         <id>{{entry.id_tag}}</id>
     </entry>

          
M skins/default/rss2.xml +18 -17
@@ 1,24 1,25 @@ 
 <?xml version="1.0"?>
 <rss version="2.0">
-<channel>
+  <channel>
 
-  <title>{{current.page.title}}</title>
-  <link>{{ext.site_url}}</link>
-  <description>{{current.description}}</description>
+    <title>{{current.page.title}}</title>
+    <link>{{ext.site_url}}</link>
+    <language>en-us</language>
+    <description>{{current.description|e}}</description>
 
-  {% for entry in ext.entries %}
-  <item> 
-    <title>{{entry.page.title}}</title>
-    <link>{{entry.linkto}}</link>
-    <pubDate>{{entry.createdon.rfc822fmt}}</pubDate>
+    {% for entry in ext.entries %}
+    <item> 
+      <title>{{entry.page.title}}</title>
+      <link>{{entry.link_ref()}}</link>
+      <pubDate>{{entry.createdon.rfc822fmt()}}</pubDate>
+  
+      <description>
+        {{entry.content()|e}}
+      </description>
     
-    <description>
-     {{entry.content|e}}
-    </description>
-    
-    <guid>{{entry.linkto}}</guid>
-  </item>
-  {% endfor %}
+      <guid>{{entry.link_ref()}}</guid>
+    </item>
+    {% endfor %}
 
-</channel>
+  </channel>
 </rss>