From 657b2336256428e6d55cc8a3fd5713e51e8dc35b Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Fri, 15 Apr 2011 19:42:35 +0200 Subject: Added a new form in the management page in order to set the number of articles load by feed to be loaded. --- utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'utils.py') diff --git a/utils.py b/utils.py index 20429b17..df6a22c4 100755 --- a/utils.py +++ b/utils.py @@ -67,6 +67,8 @@ smtp_server = config.get('mail','smtp') username = config.get('mail','username') password = config.get('mail','password') +MAX_NB_ARTICLES = -1 + # regular expression to chech 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_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\),\\\"]"), \ @@ -372,7 +374,7 @@ def load_feed(): if list_of_articles != []: list_of_articles.sort(lambda x,y: compare(y[0], x[0])) # Walk through the list of articles for the current feed. - for article in list_of_articles: + for article in list_of_articles[:MAX_NB_ARTICLES]: sha1_hash.update(article[2].encode('utf-8')) article_id = sha1_hash.hexdigest() -- cgit