From 2e5ab8765079a1757db322b269bf67077b8656a7 Mon Sep 17 00:00:00 2001 From: "duncan.parkes" Date: Sat, 24 Nov 2007 16:36:57 +0000 Subject: [PATCH] Replace the datetime.strptime with a workaround for python 2.4 --- python_scrapers/AtriumePlanning.py | 9 ++++++++- python_scrapers/RutlandLike.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/python_scrapers/AtriumePlanning.py b/python_scrapers/AtriumePlanning.py index dda04a0..62e081b 100644 --- a/python_scrapers/AtriumePlanning.py +++ b/python_scrapers/AtriumePlanning.py @@ -68,7 +68,14 @@ class AtriumePlanningParser: if td.string.strip() == "Date Registered": # We are starting a new App self._current_application = PlanningApplication() - self._current_application.date_received = datetime.datetime.strptime(td.findNext("td").string, "%d-%m-%Y") + + # + day, month, year = [int(x) for x in td.findNext("td").string.split("-")] + self._current_application.date_received = datetime.date(year, month, day) + # FIXME - when python on haggis is a bit newer, + #we can do the following, which is neater + #(and get rid of the import of time). + #self._current_application.date_received = datetime.datetime.strptime(td.findNext("td").string, "%d-%m-%Y") elif td.string.strip() == "Application Number": self._current_application.council_reference = td.findNext("td").string elif td.string.strip() == "Location": diff --git a/python_scrapers/RutlandLike.py b/python_scrapers/RutlandLike.py index 9401951..bb1773e 100644 --- a/python_scrapers/RutlandLike.py +++ b/python_scrapers/RutlandLike.py @@ -2,7 +2,7 @@ import urllib2 import urllib import urlparse -import datetime +import datetime, time #import re from BeautifulSoup import BeautifulSoup