diff options
author | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-03-04 07:48:14 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-03-04 07:48:14 +0100 |
commit | 1c0ba8fad47489ce987e628605fd106f981d8075 (patch) | |
tree | b381e4c8c910b2f2f282f6dadbda1a8c1938e358 /pyaggr3g470r/utils.py | |
parent | Typo. (diff) | |
parent | adding refresh rate to the profile form (diff) | |
download | newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.tar.gz newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.tar.bz2 newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.zip |
Merged in jaesivsm/pyaggr3g470r/evol/api (pull request #6)
Evolution Arch, API and new crawler
Diffstat (limited to 'pyaggr3g470r/utils.py')
-rwxr-xr-x | pyaggr3g470r/utils.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pyaggr3g470r/utils.py b/pyaggr3g470r/utils.py index 972909af..1fc84ff4 100755 --- a/pyaggr3g470r/utils.py +++ b/pyaggr3g470r/utils.py @@ -51,9 +51,10 @@ from collections import Counter from contextlib import contextmanager import conf -from pyaggr3g470r import db +from flask import g from pyaggr3g470r.models import User, Feed, Article + # regular expression to check URL url_finders = [ re.compile("([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp)[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+)(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\),\\\"]"), \ @@ -135,7 +136,7 @@ def import_opml(email, opml_content): return nb nb = read(subscriptions) - db.session.commit() + g.db.session.commit() return nb def import_json(email, json_content): @@ -158,7 +159,7 @@ def import_json(email, json_content): enabled=feed["enabled"]) user.feeds.append(new_feed) nb_feeds += 1 - db.session.commit() + g.db.session.commit() # Create articles for feed in json_account["result"]: @@ -178,7 +179,7 @@ def import_json(email, json_content): user_feed.articles.append(new_article) nb_articles += 1 - db.session.commit() + g.db.session.commit() return nb_feeds, nb_articles |