From 5abb32199f26bcbb1e859b0b930b18bbbe8cbea9 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Thu, 8 Jul 2010 10:47:10 +0200 Subject: It is now possilbe to delete an article individually. --- pyAggr3g470r.py | 30 ++++++++++++++++++++++++++++-- 1 file 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 = '\n' + \ '' + \ @@ -369,6 +369,8 @@ class Root: else: html += """""" % \ (feed_id, article_id) + html += """  """ % \ + (feed_id, article_id) html += "

" 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. -- cgit