aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedriconhomme <devnull@localhost>2010-10-20 11:36:52 +0200
committercedriconhomme <devnull@localhost>2010-10-20 11:36:52 +0200
commit1011d5188ad4a33c60cea5013f9679f003a7ff35 (patch)
treea78a1fb7d175426a22114790747dddce4e010838
parentRemoved HN feed (for test). (diff)
downloadnewspipe-1011d5188ad4a33c60cea5013f9679f003a7ff35.tar.gz
newspipe-1011d5188ad4a33c60cea5013f9679f003a7ff35.tar.bz2
newspipe-1011d5188ad4a33c60cea5013f9679f003a7ff35.zip
Improvements to the search method.
-rwxr-xr-xpyAggr3g470r.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 48f0f8f2..89fefe97 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -26,6 +26,7 @@ __copyright__ = "Copyright (c) 2010 Cedric Bonhomme"
__license__ = "GPLv3"
import os
+import re
import time
import sqlite3
import cherrypy
@@ -309,6 +310,7 @@ class Root:
in the description of the article.
"""
param, _, value = querystring.partition(':')
+ wordre = re.compile(r'\b%s\b' % param.lower())
feed_id = None
if param == "Feed":
feed_id, _, querystring = value.partition(':')
@@ -323,7 +325,7 @@ class Root:
article_content = utils.clear_string(article[4].encode('utf-8'))
if not article_content:
utils.clear_string(article[2].encode('utf-8'))
- if querystring.lower() in article_content.lower():
+ if wordre.findall(article_content.lower()) != []:
if article[5] == "0":
# not readed articles are in bold
not_read_begin = "<b>"
@@ -344,7 +346,7 @@ class Root:
article_content = utils.clear_string(article[4].encode('utf-8'))
if not article_content:
utils.clear_string(article[2].encode('utf-8'))
- if querystring.lower() in article_content.lower():
+ if wordre.findall(article_content.lower()) != []:
if new_feed_section is True:
new_feed_section = False
html += """<h2><a name="%s"><a href="%s" rel="noreferrer"
bgstack15