whois/parser.py
changeset 14 2bada1724be7
parent 13 f8d7b881701d
child 15 4f652607e4d8
equal deleted inserted replaced
13:f8d7b881701d 14:2bada1724be7
    63         """The first time an attribute is called it will be calculated here.
    63         """The first time an attribute is called it will be calculated here.
    64         The attribute is then set to be accessed directly by subsequent calls.
    64         The attribute is then set to be accessed directly by subsequent calls.
    65         """
    65         """
    66         whois_regex = self._regex.get(attr)
    66         whois_regex = self._regex.get(attr)
    67         if whois_regex:
    67         if whois_regex:
    68             values = re.findall(whois_regex, self.text, re.IGNORECASE)
    68             values = []
    69             # try casting to date format
    69             for value in re.findall(whois_regex, self.text, re.IGNORECASE):
    70             values = [cast_date(value.strip()) for value in values]
    70                 if isinstance(value, basestring):
       
    71                     # try casting to date format
       
    72                     value = cast_date(value.strip())
       
    73                 values.append(value)
    71             if len(values) == 1:
    74             if len(values) == 1:
    72                 values = values[0]
    75                 values = values[0]
    73             setattr(self, attr, values)
    76             setattr(self, attr, values)
    74             return getattr(self, attr)
    77             return getattr(self, attr)
    75         else:
    78         else: