diff options
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-x | pyAggr3g470r.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index af6b772e..8bf78c05 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -47,8 +47,8 @@ path = {'/css/style.css': {'tools.staticfile.on': True, \ 'tools.staticfile.filename':utils.path+'css/img/heart_open.png'}, \ '/css/img/email.png': {'tools.staticfile.on': True, \ 'tools.staticfile.filename':utils.path+'css/img/email.png'}, \ - '/var/histogram.png':{'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'var/histogram.png'}} + '/css/img/cross.png': {'tools.staticfile.on': True, \ + 'tools.staticfile.filename':utils.path+'css/img/cross.png'}} htmlheader = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' + \ '<head>' + \ @@ -369,6 +369,8 @@ class Root: else: html += """<a href="/like/yes:%s:%s"><img src="/css/img/heart_open.png" title="Click if you like this article." /></a>""" % \ (feed_id, article_id) + html += """ <a href="/delete_article/%s:%s"><img src="/css/img/cross.png" title="Delete this article" /></a>""" % \ + (feed_id, article_id) html += "<br /><br />" description = article[4].encode('utf-8') if description: @@ -788,6 +790,30 @@ class Root: remove_feed.exposed = True + def delete_article(self, param): + """ + Delete an article. + """ + try: + feed_id, article_id = param.split(':') + articles_list = self.articles[feed_id] + except: + return self.error_page("This article do not exists.") + for article in articles_list: + if article_id == article[0]: + try: + conn = sqlite3.connect(utils.sqlite_base, isolation_level = None) + c = conn.cursor() + c.execute("DELETE FROM articles WHERE article_link='" + article[3] +"'") + conn.commit() + c.close() + except Exception, e: + return e + return self.index() + + delete_article.exposed = True + + def export(self, export_method): """ Export articles stored in the SQLite database in text files. |