[nanny] May_url_blocked fixed



commit d42a930f8c6e51e0d3ce4f8ad0f28b62c179bae0
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Mon Feb 1 23:29:50 2010 +0100

    May_url_blocked fixed

 daemon/src/DansGuardianImporter.py |    6 +++---
 daemon/src/FilterManager.py        |   14 +++++++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/daemon/src/DansGuardianImporter.py b/daemon/src/DansGuardianImporter.py
index bd70c8f..129c408 100644
--- a/daemon/src/DansGuardianImporter.py
+++ b/daemon/src/DansGuardianImporter.py
@@ -172,7 +172,7 @@ class DansGuardianImporter (gobject.GObject):
             
             urls = []
             for line in fd.readlines() :
-                dg_url = line.replace("\r","").replace("\n", "").replace(" ","").decode("iso8859-15").lower()
+                dg_url = line.replace("\r","").replace("\n", "").replace(" ","")
                 urls.append(dg_url)
 
                 if is_black == True:
@@ -181,8 +181,8 @@ class DansGuardianImporter (gobject.GObject):
                     tmp_domain_item_list.reverse()
                     for x in tmp_domain_item_list:
                         tmp_domain = tmp_domain + x + "."
-                        tmp_domain=tmp_domain[:-1]                
-                        domain_set.add(tmp_domain)
+                    tmp_domain=tmp_domain[:-1]                
+                    domain_set.add(tmp_domain)
 
             urls.sort()
             
diff --git a/daemon/src/FilterManager.py b/daemon/src/FilterManager.py
index 19c956f..826983a 100644
--- a/daemon/src/FilterManager.py
+++ b/daemon/src/FilterManager.py
@@ -479,7 +479,7 @@ class FilterManager (gobject.GObject) :
 
         if custom_black == True :
             print "Custom BlackListed"
-            return [True, True, []]
+            return [True, False, []]
 
         #Search in blacklists
         for db in self.pkg_filters_conf.keys():
@@ -492,7 +492,7 @@ class FilterManager (gobject.GObject) :
                             category_c = category_c + " OR " + "category='%s' " % cat
                         else:
                             category_c = "category='%s' " % cat
-                    #category_c = category_c + "OR category='may_url_blocked'"
+                    category_c = category_c + "OR category='may_url_blocked'"
                             
                     regexp_c = 'gregexp(regexp || "(|\..+)" , "%s")' % idomain
                     sql_query = 'select distinct category from black_domains where (%s) AND (%s)' % (category_c, regexp_c)
@@ -501,6 +501,7 @@ class FilterManager (gobject.GObject) :
                     
                     try:
                         qr = block_d.blockOn()
+                        print qr
                         for cat in qr :
                             blacklisted_categories.append(cat[0])
                     except:
@@ -508,7 +509,14 @@ class FilterManager (gobject.GObject) :
                         return [False, False, []]
 
         if len (blacklisted_categories) > 0 :
-            return [True, True, blacklisted_categories]
+            if "may_url_blocked" in blacklisted_categories :
+                blacklisted_categories.pop(blacklisted_categories.index("may_url_blocked"))
+                if len (blacklisted_categories) > 0 :
+                    return [True, True, blacklisted_categories]
+                else:
+                    return [False, True, blacklisted_categories]
+            else:
+                return [True, False, blacklisted_categories]
 
         return [False, False, []]
                 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]