aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-03-10 09:22:27 +0100
committercedricbonhomme <devnull@localhost>2010-03-10 09:22:27 +0100
commit047176bb3d537c09ed44e0f62b7f8f5889ab90d7 (patch)
treeb564339e94aa65db71d983a22f2175091cb78c5d /utils.py
parentImprovement. Faster display of some pages (using oice.langdet module). (diff)
downloadnewspipe-047176bb3d537c09ed44e0f62b7f8f5889ab90d7.tar.gz
newspipe-047176bb3d537c09ed44e0f62b7f8f5889ab90d7.tar.bz2
newspipe-047176bb3d537c09ed44e0f62b7f8f5889ab90d7.zip
Improvement of the security (test URLs,etc.). Added mutex.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils.py b/utils.py
index 7b1d7285..1412a50a 100644
--- a/utils.py
+++ b/utils.py
@@ -2,8 +2,8 @@
#-*- coding: utf-8 -*-
__author__ = "Cedric Bonhomme"
-__version__ = "$Revision: 0.2 $"
-__date__ = "$Date: 2010/03/07 $"
+__version__ = "$Revision: 0.3 $"
+__date__ = "$Date: 2010/03/10 $"
__copyright__ = "Copyright (c) 2010 Cedric Bonhomme"
__license__ = "GPLv3"
@@ -30,6 +30,9 @@ try:
except:
IMPORT_ERROR.append("oice")
+import threading
+LOCKER = threading.Lock()
+
def detect_language(text):
"""
Detect the language of a text.
@@ -140,6 +143,7 @@ def load_feed():
"""
Load feeds and articles in a dictionary.
"""
+ LOCKER.acquire()
list_of_feeds = None
list_of_articles = None
try:
@@ -197,6 +201,6 @@ def load_feed():
feed[3], feed[0], feed[2], feed[1] \
)
c.close()
-
+ LOCKER.release()
return (articles, feeds)
return (articles, feeds) \ No newline at end of file
bgstack15