Permalink
Browse files

Add a list of all subscribed blogs as a subpage, per request from

Dave Page and Robert Treat.
  • Loading branch information...
1 parent e079220 commit c37d1fc10dcb317dd8aa788bc82a64735fe80b40 @mhagander committed Jun 22, 2009
Showing with 18 additions and 0 deletions.
  1. +17 −0 generator.py
  2. +1 −0 template/index.tmpl
View
@@ -36,6 +36,8 @@ def __init__(self,db):
self.items = []
self.topposters = []
self.topteams = []
+ self.allposters = []
+ self.allteams = []
self.staticfiles = ['policy','add']
settings.configure(
@@ -107,10 +109,23 @@ def Generate(self):
self.topteams.append(PlanetFeed(feed))
if len(self.topteams) < 2: self.topteams = []
+ c.execute("""
+SELECT name,blogurl,feedurl,NULL,NULL,NULL,NULL FROM planet.feeds
+WHERE approved AND team IS NULL ORDER BY name,blogurl
+""")
+ self.allposters = [PlanetFeed(feed) for feed in c.fetchall()]
+ c.execute("""
+SELECT feeds.name AS feedname,blogurl,feedurl,NULL,teams.name,teamurl,NULL
+FROM planet.feeds INNER JOIN planet.teams ON planet.feeds.team=planet.teams.id
+WHERE approved ORDER BY teams.name,feeds.name,blogurl
+""")
+ self.allteams = [PlanetFeed(feed) for feed in c.fetchall()]
+
rss.write_xml(open("www/rss20.xml","w"), encoding='utf-8')
rssshort.write_xml(open("www/rss20_short.xml","w"), encoding='utf-8')
self.WriteFromTemplate('index.tmpl', 'www/index.html')
+ self.WriteFromTemplate('feeds.tmpl', 'www/feeds.html')
for staticfile in self.staticfiles:
self.UpdateStaticFile(staticfile)
@@ -120,6 +135,8 @@ def WriteFromTemplate(self, templatename, outputname):
f.write(tmpl.render(Context({
'topposters': self.topposters,
'topteams': self.topteams,
+ 'allposters': self.allposters,
+ 'allteams': self.allteams,
'posts': self.items,
})).encode('utf-8'))
f.close()
View
@@ -36,6 +36,7 @@
<ul>
<li><a href="policy.html">Policy</a> for being listed on Planet PostgreSQL.</li>
<li><a href="add.html">Add</a> your blog to Planet PostgreSQL.</li>
+ <li><a href="feeds.html">List</a> of all subscribed blogs.</li>
<li><a href="/register/">Manage</a> your registration.</li>
</ul>
<div class="planetRightTitle">Contact</div>

0 comments on commit c37d1fc

Please sign in to comment.