From fc432ae39c8477c380de84761a211c690548350a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 18 May 2010 09:56:54 +0200 Subject: Fixed mensa module and exception handling --- modules/mensa.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'modules/mensa.py') diff --git a/modules/mensa.py b/modules/mensa.py index 9ff4bcb..5faa956 100644 --- a/modules/mensa.py +++ b/modules/mensa.py @@ -44,12 +44,18 @@ class Module(ModuleBase): data = match.group(1) r = re.compile(r'.*?]*>(.*?)', re.DOTALL) - match = r.match(data) - if not match: - return False - mealstr = match.group(1) + r2 = re.compile(r'(?:.*?]*>(.*?)){4}', re.DOTALL) + + mealstr = '' + pos = 0 + while not r2.match(mealstr): + match = r.match(data, pos) + if not match: + return False + mealstr = match.group(1) + pos = match.end() - match = r.match(data, match.end()) + match = r.match(data, pos) if not match: return False pricestr = match.group(1) -- cgit v1.2.3