aboutsummaryrefslogtreecommitdiff
path: root/src/web/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/utils.py')
-rwxr-xr-xsrc/web/utils.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/web/utils.py b/src/web/utils.py
index 91e2bd9f..1d4b30ab 100755
--- a/src/web/utils.py
+++ b/src/web/utils.py
@@ -57,10 +57,10 @@ from contextlib import contextmanager
from flask import request
import conf
-from flask import g
-from bootstrap import application as app, db
+from bootstrap import db
from web import controllers
from web.models import User, Feed, Article
+from web.lib.utils import clear_string
logger = logging.getLogger(__name__)
@@ -109,9 +109,9 @@ def fetch(id, feed_id=None):
Fetch the feeds in a new processus.
The "asyncio" crawler is launched with the manager.
"""
- cmd = [sys.executable, conf.BASE_DIR+'/manager.py', 'fetch_asyncio', str(id),
- str(feed_id)]
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ cmd = [sys.executable, conf.BASE_DIR + '/manager.py', 'fetch_asyncio',
+ str(id), str(feed_id)]
+ return subprocess.Popen(cmd, stdout=subprocess.PIPE)
def history(user_id, year=None, month=None):
"""
@@ -269,16 +269,6 @@ def open_url(url):
return (False, error)
-def clear_string(data):
- """
- Clear a string by removing HTML tags, HTML special caracters
- and consecutive white spaces (more that one).
- """
- p = re.compile('<[^>]+>') # HTML tags
- q = re.compile('\s') # consecutive white spaces
- return p.sub('', q.sub(' ', data))
-
-
def load_stop_words():
"""
Load the stop words and return them in a list.
bgstack15