Commits

Tim Freund committed e29f30a

Stubbed out atom feeds

Comments (0)

Files changed (4)

ironblogger/models.py

 DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
 Base = declarative_base()
 
+class Feed(object):
+    def __init__(self, feed_url=None, html_url=None, 
+                 entries=[], updated_at=None):
+        self.feed_url = feed_url
+        self.html_url = html_url
+        self.entries = entries
+
+        if updated_at is None:
+            self.updated_at = datetime.now()
+        else:
+            self.updated_at = updated_at
+
 class GUID(TypeDecorator):
     """Platform-independent GUID type.
 

ironblogger/routes.py

                      view=iron_blogger_atom,
                      renderer="templates/atom.pt")
     config.add_route('posts_atom', '/{slug}/posts_atom.xml',
-                     view=posts_atom,
+                     view=iron_blogger_posts_atom,
                      renderer="templates/atom.pt")
     config.add_route('iron_blogger_opml', '/{slug}/opml.xml',
                      view=iron_blogger_opml,

ironblogger/templates/opml.pt

 <?xml version="1.0"?>
 <opml version="1.0">
   <head>
-    <title>${iron_blogger.name} Feed List</title>
+    <title>${ib.name} Feed List</title>
   </head>
   <body>
-    <outline tal:repeat="blog iron_blogger.blogs" title="${blog.name}" text="" description="" type="" xmlUrl="${blog.feed_url}" htmlUrl="${blog.default_url}"/>
+    <outline tal:repeat="blog ib.blogs" title="${blog.name}" text="" description="" type="" xmlUrl="${blog.feed_url}" htmlUrl="${blog.default_url}"/>
   </body>
 </opml>

ironblogger/views.py

 @require_iron_blogger
 def iron_blogger_atom(context, request):
     ib = request.environ['iron_blogger']
-    return {}
+
+    feed = Feed('http://localhost/atom.xml',
+                'http://localhost',
+                [])
+    return {'feed': feed}
+
+@require_iron_blogger
+def iron_blogger_posts_atom(context, request):
+    ib = request.environ['iron_blogger']
+
+    feed = Feed('http://localhost/atom.xml',
+                'http://localhost',
+                [])
+    return {'feed': feed}
 
 @require_iron_blogger
 def iron_blogger_opml(context, request):
     ib = DBSession.query(IronBlogger).filter(IronBlogger.slug==request.matchdict['slug']).first()
     return {'ib': ib}
 
-@require_iron_blogger
-def posts_atom(request):
-    return {}
-