aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-12-03 08:11:32 +0100
committercedricbonhomme <devnull@localhost>2010-12-03 08:11:32 +0100
commit5d049dce3382bda83dd859461a107e8e87b633ce (patch)
tree20e8a8b1fc90c6fe200ab5a19c5f4eb68ef95121 /pyAggr3g470r.py
parentUpdated code for new data structure. #4 (diff)
downloadnewspipe-5d049dce3382bda83dd859461a107e8e87b633ce.tar.gz
newspipe-5d049dce3382bda83dd859461a107e8e87b633ce.tar.bz2
newspipe-5d049dce3382bda83dd859461a107e8e87b633ce.zip
Updated code for new data structure. #5
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 5bbc83fe..e5f0cd98 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -895,26 +895,23 @@ class Root:
except:
return self.error_page("Bad URL")
try:
- feed = self.feeds[feed_id]
- except KeyError:
- return self.error_page("This feed do not exists.")
- for article in feed.articles:
- if article_id == article.article_id:
- try:
- conn = sqlite3.connect(utils.sqlite_base, isolation_level = None)
- c = conn.cursor()
- # Mark all articles as read.
- if action == "yes":
- c.execute("UPDATE articles SET like=1 WHERE article_link='" + \
- article.article_link + "'")
- if action == "no":
- c.execute("UPDATE articles SET like=0 WHERE article_link='" + \
- article.article_link + "'")
- conn.commit()
- c.close()
- except Exception:
- self.error_page("Impossible to like/dislike this article (database error).")
- break
+ article = self.feeds[feed_id].articles[article_id]
+ except:
+ self.error_page("This article do not exists.")
+ try:
+ conn = sqlite3.connect(utils.sqlite_base, isolation_level = None)
+ c = conn.cursor()
+ # Mark all articles as read.
+ if action == "yes":
+ c.execute("UPDATE articles SET like=1 WHERE article_link='" + \
+ article.article_link + "'")
+ if action == "no":
+ c.execute("UPDATE articles SET like=0 WHERE article_link='" + \
+ article.article_link + "'")
+ conn.commit()
+ c.close()
+ except Exception:
+ self.error_page("Impossible to like/dislike this article (database error).")
return self.description(feed_id+":"+article_id)
like.exposed = True
bgstack15