aboutsummaryrefslogtreecommitdiff
path: root/src/web/utils.py
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-02-02 23:15:37 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-02-02 23:15:37 +0100
commit082bf39a7dd7296d4f51b6b124d185135dc00989 (patch)
tree6e12cf2b67b016aff38874c389b5bf8b5242749a /src/web/utils.py
parentfixing logging (diff)
parentreload and fold all button (diff)
downloadnewspipe-082bf39a7dd7296d4f51b6b124d185135dc00989.tar.gz
newspipe-082bf39a7dd7296d4f51b6b124d185135dc00989.tar.bz2
newspipe-082bf39a7dd7296d4f51b6b124d185135dc00989.zip
Merge branch 'feature/categories'
close #22 close #23
Diffstat (limited to 'src/web/utils.py')
-rwxr-xr-xsrc/web/utils.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/web/utils.py b/src/web/utils.py
index 91e2bd9f..fcd791e8 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__)
@@ -111,7 +111,7 @@ def fetch(id, feed_id=None):
"""
cmd = [sys.executable, conf.BASE_DIR+'/manager.py', 'fetch_asyncio', str(id),
str(feed_id)]
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ 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