summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-03-07 19:47:25 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-03-07 19:47:25 +0100
commitb07ceef46be030b0c82855149b1fe5d55bc4cebb (patch)
tree18f5bbfd7765ccbcd31abc6bdce33903aecafe3b /modules
parentab10b2ae43036067efc106c091c5703db6f8adca (diff)
downloadcurunir-b07ceef46be030b0c82855149b1fe5d55bc4cebb.tar
curunir-b07ceef46be030b0c82855149b1fe5d55bc4cebb.zip
Made the mensa module a bit more flexible
Diffstat (limited to 'modules')
-rw-r--r--modules/mensa.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/mensa.py b/modules/mensa.py
index 4867670..d8ee447 100644
--- a/modules/mensa.py
+++ b/modules/mensa.py
@@ -79,7 +79,7 @@ class Module(ModuleBase):
row = handle_data_row(data, pos)
if not row:
- return False
+ break
meals.append(row[0])
pos = row[1]
@@ -113,6 +113,12 @@ class Module(ModuleBase):
stripunescape = (lambda item: (unescape(item[0].strip()), unescape(item[1].strip())))
meals = map(lambda item: map(stripunescape, item), meals)
+ if len(meals) == 0:
+ return False
+
+ while len(meals) < 6:
+ meals.insert(len(meals)-1, [[None], [None], [None], [None], [None]])
+
reply = 'Mensa-Menü für den %s\n\n' % day.strftime('%d.%m.%y')
if meals[0][weekday][0]:
reply += 'Eintopf: %s (%s)\n' % meals[0][weekday]
@@ -122,10 +128,10 @@ class Module(ModuleBase):
reply += 'Hauptgericht 2: %s (%s)\n' % meals[3][weekday]
if meals[2][weekday][0]:
reply += 'Vegetarisches Hauptgericht: %s (%s)\n' % meals[2][weekday]
- #if meals[4][weekday][0]:
- # reply += 'Wok: %s (%s)\n' % meals[4][weekday]
if meals[4][weekday][0]:
- reply += 'Beilagen: %s (%s)\n' % meals[4][weekday]
+ reply += 'Wok: %s (%s)\n' % meals[4][weekday]
+ if meals[5][weekday][0]:
+ reply += 'Beilagen: %s (%s)\n' % meals[5][weekday]
return reply