partial implementation of feed (atom, rss) handlers
M muyhomepage2/app/configuration.py +12 -2
@@ 4,6 4,7 @@ from muyhomepage2.pagehandlers.tagsummar
 from muyhomepage2.pagehandlers.tagglobal import TagGlobalHandler
 from muyhomepage2.pagehandlers.software import SoftwareHandler
 from muyhomepage2.pagehandlers.blog import BlogHandler
+from muyhomepage2.pagehandlers import feeds
 
 
 DEFAULT_HANDLERS = {

          
@@ 12,8 13,8 @@ DEFAULT_HANDLERS = {
     'tagsummary': TagSummaryHandler,
     'tagglobal': TagGlobalHandler,
     'software': SoftwareHandler,
-    'atom': StandardHandler,
-    'rss2': StandardHandler,
+    'atom': feeds.AtomHandler,
+    'rss2': feeds.RssHandler,
     }
 
 

          
@@ 54,3 55,12 @@ class Config(object):
     def icontags(self):
         return {'Technology': '/~john/cruft/static/tagicon-tech.png'}
 
+    def base_url(self):
+        return 'http://karnak.nile/~john/cruft'
+
+    def site_author(self):
+        return 'John Mulligan'
+
+    def site_atom_id(self):
+        return 'tag:asynchrono.us,2006-01-02:birch-street-computing'
+

          
A => muyhomepage2/pagehandlers/feeds.py +51 -0
@@ 0,0 1,51 @@ 
+
+import os
+from muyhomepage2.pagehandlers import handler
+from muyhomepage2.pagehandlers import standard
+from muyhomepage2.text import wikirst
+from muyhomepage2 import page
+from muyhomepage2 import util
+
+
+class FeedEntryHandler(standard.StandardHandler):
+    pass
+    # linkto
+    # id_tag
+
+
+class BaseFeedHandler(handler.PageHandler):
+    def content(self):
+        return wikirst.format(self.page.body)
+
+    @property
+    def description(self):
+        return self.content()
+
+    def _getentries(self, website, config):
+        return []
+
+    def extension(self, website, config):
+        site_url = config.base_url()
+        entries = self._getentries(website, config)
+        if entries:
+            feed_mod = entries[0].modifiedon
+        else:
+            feed_mod = util.When(0)
+        return {
+            'site_url': site_url,
+            'self_url': os.path.join(site_url, self.finalname()),
+            'feed_updated': feed_mod,
+            'feed_author': config.site_author(),
+            'feed_id_tag': config.site_atom_id(),
+            'entries': entries,
+            }
+
+
+class AtomHandler(BaseFeedHandler):
+    def template(self):
+        return 'atom.xml'
+
+
+class RssHandler(BaseFeedHandler):
+    def template(self):
+        return 'rss2.xml'

          
M skins/default/atom.xml +2 -2
@@ 2,7 2,7 @@ 
 <feed xmlns="http://www.w3.org/2005/Atom">
     <title>{{current.page.title}}</title>
     <link href="{{ext.site_url}}"></link>
-    <link rel="self" href="{{ext.atom_url}}"></link>
+    <link rel="self" href="{{ext.self_url}}"></link>
     <updated>{{ext.feed_updated}}</updated>
 
     <author>

          
@@ 19,7 19,7 @@ 
         <published>{{entry.createdon.atomfmt}}</published>
 
         <content type="html">
-            Escaped HTML GOES HERE.
+            {{entry.content()|e}}
         </content>
 
         <id>{{entry.id_tag}}</id>

          
M skins/default/rss2.xml +1 -1
@@ 13,7 13,7 @@ 
     <pubDate>{{entry.createdon.rfc822fmt}}</pubDate>
     
     <description>
-     {{entry.content|escapex}}
+     {{entry.content|e}}
     </description>
     
     <guid>{{entry.linkto}}</guid>