aboutsummaryrefslogtreecommitdiff
path: root/mensa/backends/singh.py
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-03 09:18:28 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-03 09:18:28 +0200
commit3d4cb8555196a08347e373b6e542f80159155261 (patch)
tree9abb893a39da87f927d3180f27e787be619f3fed /mensa/backends/singh.py
parent0e757e1d3822a0adeeb086fbf3e56c20cb1bdb40 (diff)
downloadmensa-3d4cb8555196a08347e373b6e542f80159155261.tar.gz
mensa-3d4cb8555196a08347e373b6e542f80159155261.tar.bz2
mensa-3d4cb8555196a08347e373b6e542f80159155261.zip
Cleanup, bump version to 0.4
This version breaks backend compatibility with 0.3.x; it turns the old list-based format into an OrderedDict-based format, sorted by category. This makes the renderers cleaner and easier to write.
Diffstat (limited to 'mensa/backends/singh.py')
-rw-r--r--mensa/backends/singh.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mensa/backends/singh.py b/mensa/backends/singh.py
index 393b5da..3e76190 100644
--- a/mensa/backends/singh.py
+++ b/mensa/backends/singh.py
@@ -7,6 +7,7 @@ import sys
import datetime
from mensa.base import *
from yapsy.IPlugin import IPlugin
+from collections import OrderedDict
class Signh(IPlugin) :
def register_restaurants(self) :
@@ -27,7 +28,7 @@ class Signh(IPlugin) :
the_page = response.read()
document = html5lib.parse(the_page, treebuilder="lxml")
groupsel = CSSSelector('.menu-list__items')
- myorder=[0,3,1,4,2]
+ myorder=[0,3,1,4,2] # Weird order for weekdays, due to page layout.
mylist = [ groupsel(document)[i] for i in myorder]
i = mylist[weekday]
fl = []
@@ -48,9 +49,8 @@ class Signh(IPlugin) :
veg = 2
fl.append(Food(name, price, "Essen", veg, desc))
sys.stderr = s
- return fl
+ k = OrderedDict()
+ k["Essen"] = fl
+ return k
-if __name__ == "__main__":
- food = get_food_items()
- print(formt(food))