Commits

Anonymous committed c8507b3

valid Atom feed

Comments (0)

Files changed (4)

 #       MA 02110-1301, USA.
 
 import models
+from lib.cfg import read_config_file
 import views
 
+CFG_FILE = 'myapp.cfg'
+
 
 class FeedHandler(views.BaseHandler):
     ''' Feed handler. '''
         posts = models.BlogPost.all()
         posts.order('-created')
         posts.fetch(limit=10)
-
-        #if posts:
-        #    latest = posts[0]
-        #else:
-        #    latest = None
         
-        self.response.headers['Content-Type'] = 'application/rss+xml'
-
-        self.render('rss2.xml', {
+        author_name = read_config_file(
+            CFG_FILE, 'administrator', 'admin_name')
+        author_email = read_config_file(
+            CFG_FILE, 'administrator', 'admin_email')
+        
+        self.response.headers['Content-Type'] = 'application/atom+xml'
+        self.render('atom.xml', {
+            'author_name': author_name,
+            'author_email': author_email,
             'posts': posts,
-            #'latest': latest,
-            'title': 'in-beta.appspot.com RSS feed'
+            'title': 'in-beta.appspot.com feed'
         })

templates/admin.html

     <div>
       <input type="submit" name="submit" value="Edit" />
     </div>
+    <br />
     {% for blog_post in results %}
         <div>
             <input type="radio" name="blog_key" value={{ blog_post.key }} />
         </div>
         <br />
     {% endfor %}
-    <br />
     <div>
       <input type="submit" name="submit" value="Edit" />
     </div>

templates/base.html

         <p>
           <a class="no_u" href="http://code.google.com/appengine/"><img src="/static/img/appengine-silver-120x30.gif" alt="Powered by Google App Engine" /></a>
           <a class="no_u" href="http://validator.w3.org/check?uri=referer"><img src="/static/img/valid-xhtml10-blue.png" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
+          <a class="no_u" href="http://validator.w3.org/feed/check.cgi?url=http%3A//in-beta.appspot.com/feed"><img src="/static/img/valid-atom.png" alt="Valid Atom 1.0" title="Validate my Atom 1.0 feed" /></a>
         </p>
       </div>
     </div>

templates/index.html

     </div>
     <br />
     <br />
-    <br />
-    <br />
 {% endfor %}
 
-{% if prev_page %} 
+<div>
+  {% if prev_page %} 
     <a href="?bookmark={{ prev_page }}">&lt;&lt;&lt;&nbsp;newer posts</a>
     &nbsp;
-{% endif %}
+  {% endif %}
 
-{% if next_page %}
+  {% if next_page %}
     &nbsp;
     <a href="?bookmark={{ next_page }}">older posts&nbsp;&gt;&gt;&gt;</a> 
-{% endif %}
+  {% endif %}
+</div>
+<br />
     
 {% endblock %}