From 182d489f306c5fb1b0a16df52a9c851b702f231e Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 7 Jun 2005 11:42:44 +0000 Subject: [PATCH] mcyar; --- Itinerary.py | 112 +++++++++++++++++++++++++++++++++++++++-- tests/test_itinerary_parser.py | 36 +++++++++++++ 2 files changed, 144 insertions(+), 4 deletions(-) create mode 100755 tests/test_itinerary_parser.py diff --git a/Itinerary.py b/Itinerary.py index e4c737e..e3e5db3 100644 --- a/Itinerary.py +++ b/Itinerary.py @@ -4,6 +4,7 @@ """mcPlan""" import sre +from HTMLParser import HTMLParser, HTMLParseError import Planner from PlannerExceptions import * @@ -14,11 +15,12 @@ class Itinerary: self.end = end self.html = html - self._parseIt(html) + itinParser = ItineraryParser() - def _parseIt(self, html): - # Extract the HTML chunk for the actual itinerary. - itin = self._extractItin(html) + # Extract the HTML chunk for the actual itinerary, and feed it to + # the sub-parser. + itinParser.feed(self._extractItin(html)) + itinParser.close() def _extractItin(self, html): match = _itin_rx.search(html) @@ -32,3 +34,105 @@ _itin_re = ('