Esempio n. 1
0
 def get_date(self, tag):
     raw = tag.string.strip()
     match = self._ptn_date.match(raw)
     if not match:
         raise Exception('date format did not match pattern')
     year = 2012
     month = common.get_month_by_name(match.group(1))
     day = int(match.group(2))
     return datetime.date(year, month, day)
Esempio n. 2
0
 def get_date_from_body(self, body):
     match = self._ptn_date2.match(body)
     if not match:
         print body
         raise Exception('date format did not match pattern')
     year = 2012
     month = common.get_month_by_name(match.group(1))
     day = int(match.group(2))
     return datetime.date(year, month, day)