summaryrefslogtreecommitdiff
blob: 4b727c7067d9a42e2c988aa7869757becddae56e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From b5611dfa0510ec8fbaa2db4b6834d0bd7ecf0909 Mon Sep 17 00:00:00 2001
From: Jesse <jessefrgsmith@yahoo.ca>
Date: Sat, 27 Jun 2015 20:24:44 -0300
Subject: [PATCH] Fixed a type check which was causing syntax/undefined errors
 in DenyHosts/report.py when switching between Python2 and Python3.

---
 CHANGELOG.txt       | 8 ++++++++
 DenyHosts/report.py | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ca173cb..b585332 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,5 +1,13 @@
 DENYHOSTS CHANGELOG
 
+3.1
+======================
+
+Fixed a type check in DenyHosts/report.py which was causing
+problems when moving between Python2 and Python3.
+
+
+
 3.0
 ======================
 
diff --git a/DenyHosts/report.py b/DenyHosts/report.py
index 05f3e3d..9560eab 100644
--- a/DenyHosts/report.py
+++ b/DenyHosts/report.py
@@ -3,6 +3,7 @@
 import socket
 # Removing this as it causes runtime errors on Python3.4
 # from types import ListType, TupleType
+import types
 from .util import is_true
 try:
     import syslog
@@ -38,7 +39,8 @@ def get_report(self):
     def add_section(self, message, iterable):
         self.report += "%s:\n\n" % message
         for i in iterable:
-            if type(i) in (TupleType, ListType):
+            # if type(i) in (TupleType, ListType):
+            if (type(i) is types.ListType) or (type(i) is types.TupleType):
                 extra = ": %d\n" % i[1]
                 i = i[0]
             else: