Author: johnnyg
Revision: 5927
Log:
Allow for colons in PeerGuardian/SafePeer lists' descriptions.
Check that the start & end range resembles an ip when checking a list's
validity.
Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog 2009-11-09 01:52:58 UTC (rev 5926)
+++ branches/1.2_RC/ChangeLog 2009-11-09 08:54:13 UTC (rev 5927)
@@ -20,6 +20,7 @@
==== Blocklist ====
* Force blocklist to auto-detect format when a download / import is
forced
+ * Fix blocklist failing on certain PeerGuardian/SafePeer lists
=== Deluge 1.2.0_rc3 (01 November 2009) ===
==== Core ====
Modified: branches/1.2_RC/deluge/plugins/blocklist/blocklist/readers.py
===================================================================
--- branches/1.2_RC/deluge/plugins/blocklist/blocklist/readers.py
2009-11-09 01:52:58 UTC (rev 5926)
+++ branches/1.2_RC/deluge/plugins/blocklist/blocklist/readers.py
2009-11-09 08:54:13 UTC (rev 5927)
@@ -34,6 +34,7 @@
#
from common import raiseError, remove_zeros
+import re
class ReaderParseError(Exception):
pass
@@ -69,6 +70,9 @@
if not self.is_ignored(line):
try:
(start, end) = self.parse(line)
+ if not re.match("^(\d{1,3}\.){4}$", start + ".") or \
+ not re.match("^(\d{1,3}\.){4}$", end + "."):
+ valid = False
except:
valid = False
finally:
@@ -94,7 +98,7 @@
"""Blocklist reader for SafePeer style blocklists"""
@raiseError(ReaderParseError)
def parse(self, line):
- return line.strip().split(":")[1].split("-")
+ return line.strip().split(":")[-1].split("-")
class PeerGuardianReader(SafePeerReader):
"""Blocklist reader for PeerGuardian style blocklists"""
Modified: trunk/deluge/plugins/blocklist/blocklist/readers.py
===================================================================
--- trunk/deluge/plugins/blocklist/blocklist/readers.py 2009-11-09 01:52:58 UTC
(rev 5926)
+++ trunk/deluge/plugins/blocklist/blocklist/readers.py 2009-11-09 08:54:13 UTC
(rev 5927)
@@ -34,6 +34,7 @@
#
from common import raiseError, remove_zeros
+import re
class ReaderParseError(Exception):
pass
@@ -69,6 +70,9 @@
if not self.is_ignored(line):
try:
(start, end) = self.parse(line)
+ if not re.match("^(\d{1,3}\.){4}$", start + ".") or \
+ not re.match("^(\d{1,3}\.){4}$", end + "."):
+ valid = False
except:
valid = False
finally:
@@ -94,7 +98,7 @@
"""Blocklist reader for SafePeer style blocklists"""
@raiseError(ReaderParseError)
def parse(self, line):
- return line.strip().split(":")[1].split("-")
+ return line.strip().split(":")[-1].split("-")
class PeerGuardianReader(SafePeerReader):
"""Blocklist reader for PeerGuardian style blocklists"""
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---