from planethtml import *
class Generator:
- def __init__(self,db):
- self.db = db
+ def __init__(self,cfg):
+ self.db = psycopg2.connect(cfg.get('planet','db'))
self.tidyopts = dict( drop_proprietary_attributes=1,
alt_text='',
hide_comments=1,
self.allposters = []
self.allteams = []
self.staticfiles = ['policy','add']
+ if cfg.has_option('twitter','account'):
+ self.twittername = cfg.get('twitter','account')
+ else:
+ self.twittername = None
settings.configure(
TEMPLATE_DIRS=('template',),
'allposters': self.allposters,
'allteams': self.allteams,
'posts': self.items,
+ 'twittername': self.twittername,
})).encode('utf-8'))
f.close()
if __name__=="__main__":
c = ConfigParser.ConfigParser()
c.read('planet.ini')
- Generator(psycopg2.connect(c.get('planet','db'))).Generate()
+ Generator(c).Generate()
<li><a href="rss20.xml"><img src="img/feed-icon-14x14.png" alt="rss" /></a> <a href="rss20.xml">All feeds (full entries)</a></li>
<li><a href="rss20_short.xml"><img src="img/feed-icon-14x14.png" alt="rss" /></a> <a href="rss20_short.xml">All feeds (short entries)</a></li>
</ul>
+{%if twittername %}
+ <div class="planetRightTitle">Twitter</div>
+ <ul>
+ <li>Follow @<a href="http://twitter.com/{{twittername}}">{{twittername}}</a> on Twitter for the latest updates!</li>
+ </ul>
+{%endif%}
<div class="planetRightTitle">Planet</div>
<ul>
<li><a href="policy.html">Policy</a> for being listed on Planet PostgreSQL.</li>