equal
deleted
inserted
replaced
22 '%Y.%m.%d', # 2000.01.02 |
22 '%Y.%m.%d', # 2000.01.02 |
23 '%Y/%m/%d', # 2000/01/02 |
23 '%Y/%m/%d', # 2000/01/02 |
24 '%d-%b-%Y %H:%M:%S %Z', # 24-Jul-2009 13:20:03 UTC |
24 '%d-%b-%Y %H:%M:%S %Z', # 24-Jul-2009 13:20:03 UTC |
25 '%a %b %d %H:%M:%S %Z %Y', # Tue Jun 21 23:59:59 GMT 2011 |
25 '%a %b %d %H:%M:%S %Z %Y', # Tue Jun 21 23:59:59 GMT 2011 |
26 '%Y-%m-%dT%H:%M:%SZ', # 2007-01-26T19:10:31Z |
26 '%Y-%m-%dT%H:%M:%SZ', # 2007-01-26T19:10:31Z |
|
27 '%Y-%m-%d %H:%M:%SZ', # 2000-08-22 18:55:20Z |
|
28 '%d %b %Y %H:%M:%S', # 08 Apr 2013 05:44:00 |
27 ] |
29 ] |
28 |
30 |
29 for known_format in known_formats: |
31 for known_format in known_formats: |
30 try: |
32 try: |
31 return datetime.strptime(s.strip(), known_format) |
33 return datetime.strptime(s.strip(), known_format) |
68 values = [] |
70 values = [] |
69 for value in re.findall(whois_regex, self.text, re.IGNORECASE): |
71 for value in re.findall(whois_regex, self.text, re.IGNORECASE): |
70 if isinstance(value, basestring): |
72 if isinstance(value, basestring): |
71 # try casting to date format |
73 # try casting to date format |
72 value = cast_date(value.strip()) |
74 value = cast_date(value.strip()) |
73 values.append(value) |
75 if value not in values: |
|
76 # avoid duplicates |
|
77 values.append(value) |
74 if len(values) == 1: |
78 if len(values) == 1: |
75 values = values[0] |
79 values = values[0] |
|
80 |
76 setattr(self, attr, values) |
81 setattr(self, attr, values) |
77 return getattr(self, attr) |
82 return getattr(self, attr) |
78 else: |
83 else: |
79 raise KeyError('Unknown attribute: %s' % attr) |
84 raise KeyError('Unknown attribute: %s' % attr) |
80 |
85 |