Fixed mensa module and exception handling
This commit is contained in:
parent
f95b596818
commit
fc432ae39c
2 changed files with 13 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import traceback
|
||||||
|
|
||||||
class ModuleBase:
|
class ModuleBase:
|
||||||
def __init__(self, manager):
|
def __init__(self, manager):
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
|
|
@ -44,12 +44,18 @@ class Module(ModuleBase):
|
||||||
data = match.group(1)
|
data = match.group(1)
|
||||||
|
|
||||||
r = re.compile(r'.*?<tr[^>]*>(.*?)</tr>', re.DOTALL)
|
r = re.compile(r'.*?<tr[^>]*>(.*?)</tr>', re.DOTALL)
|
||||||
match = r.match(data)
|
r2 = re.compile(r'(?:.*?<td[^>]*>(.*?)</td>){4}', re.DOTALL)
|
||||||
|
|
||||||
|
mealstr = ''
|
||||||
|
pos = 0
|
||||||
|
while not r2.match(mealstr):
|
||||||
|
match = r.match(data, pos)
|
||||||
if not match:
|
if not match:
|
||||||
return False
|
return False
|
||||||
mealstr = match.group(1)
|
mealstr = match.group(1)
|
||||||
|
pos = match.end()
|
||||||
|
|
||||||
match = r.match(data, match.end())
|
match = r.match(data, pos)
|
||||||
if not match:
|
if not match:
|
||||||
return False
|
return False
|
||||||
pricestr = match.group(1)
|
pricestr = match.group(1)
|
||||||
|
|
Reference in a new issue