'uuid': self.uuid,
'tags': self.get_tags_links(),
'comments': len(self.comments),
+ 'flattrbtn': self.get_flattr_btn(),
'created': self.created.isoformat(' '),
'ciso': self.created.isoformat(),
(blog_url, urllib.quote(t), sanitize(t) ))
return ', '.join(l)
+ def get_flattr_btn(self):
+ v = dict()
+ v['tags'] = ','.join([sanitize(tag) for tag in self.tags])
+ v['tags'] = v['tags'].replace('"', '-').replace(':', '-')
+ v['tags'] = v['tags'].replace(';', '-')
+ v['title'] = sanitize(self.title)
+ v['qtitle'] = title.replace('"', '')
+ v['url'] = full_url + '/post/' + self.uuid
+ v['furl'] = 'https://flattr.com/submit/auto?' + urllib.urlencode(
+ dict(user_id='llucax', url=v['url'],
+ title=self.title,
+ description="Blog article titled: " +
+ self.title,
+ language='en', tags=','.join(self.tags),
+ category='text'))
+ return '''
+<a class="FlattrButton" style="display:none;"
+ rel="flattr;uid:llucax;category:text;tags:%(tags)s;button:compact;"
+ title="%(qtitle)s" lang="en"
+ href="%(url)s">Blog article titled: %(title)s</a>
+<noscript><a href="%(furl)s" target="_blank">
+ <img src="http://api.flattr.com/button/flattr-badge-large.png"
+ alt="Flattr this" title="Flattr this" border="0" />
+ </a>
+</noscript>
+''' % v
+
class ArticleDB (object):
def __init__(self, dbpath):