aboutsummaryrefslogtreecommitdiff
path: root/src/web/views
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-10 13:57:50 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-10 13:57:50 +0200
commit57b08c20597f24b46679e2d209b9e13886daa3e3 (patch)
tree091aba4476b2db7257e49e792269d1a15cb0e760 /src/web/views
parentMoved notifications module. (diff)
downloadnewspipe-57b08c20597f24b46679e2d209b9e13886daa3e3.tar.gz
newspipe-57b08c20597f24b46679e2d209b9e13886daa3e3.tar.bz2
newspipe-57b08c20597f24b46679e2d209b9e13886daa3e3.zip
Start to clean generic utils functions.
Diffstat (limited to 'src/web/views')
-rw-r--r--src/web/views/feed.py10
-rw-r--r--src/web/views/home.py4
-rw-r--r--src/web/views/user.py12
3 files changed, 13 insertions, 13 deletions
diff --git a/src/web/views/feed.py b/src/web/views/feed.py
index b6e0974a..b49495f3 100644
--- a/src/web/views/feed.py
+++ b/src/web/views/feed.py
@@ -10,7 +10,7 @@ from flask.ext.babel import gettext
from flask.ext.login import login_required, current_user
import conf
-from web import utils
+from web.lib import misc_utils, utils
from web.lib.view_utils import etag_match
from web.lib.feed_utils import construct_feed_from
from web.forms import AddFeedForm
@@ -47,8 +47,8 @@ def feed(feed_id=None):
articles = ArticleController(current_user.id) \
.read(feed_id=feed_id) \
.order_by(desc("date")).all()
- top_words = utils.top_words(articles, n=50, size=int(word_size))
- tag_cloud = utils.tag_cloud(top_words)
+ top_words = misc_utils.top_words(articles, n=50, size=int(word_size))
+ tag_cloud = misc_utils.tag_cloud(top_words)
today = datetime.now()
try:
@@ -126,7 +126,7 @@ def bookmarklet():
feed = feed_contr.create(**feed)
flash(gettext('Feed was successfully created.'), 'success')
if feed.enabled and conf.CRAWLING_METHOD == "classic":
- utils.fetch(current_user.id, feed.id)
+ misc_utils.fetch(current_user.id, feed.id)
flash(gettext("Downloading articles for the new feed..."), 'info')
return redirect(url_for('feed.form', feed_id=feed.id))
@@ -215,7 +215,7 @@ def process_form(feed_id=None):
feed_title=new_feed.title), 'success')
if conf.CRAWLING_METHOD == "classic":
- utils.fetch(current_user.id, new_feed.id)
+ misc_utils.fetch(current_user.id, new_feed.id)
flash(gettext("Downloading articles for the new feed..."), 'info')
return redirect(url_for('feed.form', feed_id=new_feed.id))
diff --git a/src/web/views/home.py b/src/web/views/home.py
index 12a06024..5a8312b4 100644
--- a/src/web/views/home.py
+++ b/src/web/views/home.py
@@ -8,7 +8,7 @@ from flask.ext.babel import gettext
import conf
from web.lib.utils import redirect_url
-from web import utils
+from web.lib import misc_utils
from web.lib.view_utils import etag_match
from web.models import Article
from web.views.common import jsonify
@@ -148,7 +148,7 @@ def fetch(feed_id=None):
"""
if conf.CRAWLING_METHOD == "classic" \
and (not conf.ON_HEROKU or current_user.is_admin):
- utils.fetch(current_user.id, feed_id)
+ misc_utils.fetch(current_user.id, feed_id)
flash(gettext("Downloading articles..."), "info")
else:
flash(gettext("The manual retrieving of news is only available " +
diff --git a/src/web/views/user.py b/src/web/views/user.py
index 8568439f..3928f5dc 100644
--- a/src/web/views/user.py
+++ b/src/web/views/user.py
@@ -7,7 +7,7 @@ from flask.ext.login import login_required, current_user
import conf
from notifications import notifications
-from web import utils
+from web.lib import misc_utils
from web.lib.user_utils import confirm_token
from web.controllers import (UserController, FeedController, ArticleController,
CategoryController)
@@ -28,13 +28,13 @@ def management():
if None != request.files.get('opmlfile', None):
# Import an OPML file
data = request.files.get('opmlfile', None)
- if not utils.allowed_file(data.filename):
+ if not misc_utils.allowed_file(data.filename):
flash(gettext('File not allowed.'), 'danger')
else:
try:
- nb = utils.import_opml(current_user.email, data.read())
+ nb = misc_utils.import_opml(current_user.email, data.read())
if conf.CRAWLING_METHOD == "classic":
- utils.fetch(current_user.email, None)
+ misc_utils.fetch(current_user.email, None)
flash(str(nb) + ' ' + gettext('feeds imported.'),
"success")
flash(gettext("Downloading articles..."), 'info')
@@ -44,11 +44,11 @@ def management():
elif None != request.files.get('jsonfile', None):
# Import an account
data = request.files.get('jsonfile', None)
- if not utils.allowed_file(data.filename):
+ if not misc_utils.allowed_file(data.filename):
flash(gettext('File not allowed.'), 'danger')
else:
try:
- nb = utils.import_json(current_user.email, data.read())
+ nb = misc_utils.import_json(current_user.email, data.read())
flash(gettext('Account imported.'), "success")
except:
flash(gettext("Impossible to import the account."),
bgstack15