fixed tuple string patch
authorRichard Baron Penman
Wed, 09 Jan 2013 09:07:47 +1100
changeset 14 2bada1724be7
parent 13 f8d7b881701d
child 15 4f652607e4d8
fixed tuple string patch
whois/__init__.py
whois/parser.py
--- a/whois/__init__.py	Wed Jan 09 09:00:47 2013 +1100
+++ b/whois/__init__.py	Wed Jan 09 09:07:47 2013 +1100
@@ -10,7 +10,6 @@
     # clean domain to expose netloc
     domain = extract_domain(url)
     try:
-        raise OSError()
         # try native whois command first
         r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)
         text = r.stdout.read()
--- a/whois/parser.py	Wed Jan 09 09:00:47 2013 +1100
+++ b/whois/parser.py	Wed Jan 09 09:07:47 2013 +1100
@@ -65,9 +65,12 @@
         """
         whois_regex = self._regex.get(attr)
         if whois_regex:
-            values = re.findall(whois_regex, self.text, re.IGNORECASE)
-            # try casting to date format
-            values = [cast_date(value.strip()) for value in values]
+            values = []
+            for value in re.findall(whois_regex, self.text, re.IGNORECASE):
+                if isinstance(value, basestring):
+                    # try casting to date format
+                    value = cast_date(value.strip())
+                values.append(value)
             if len(values) == 1:
                 values = values[0]
             setattr(self, attr, values)