Browse Source

Nome stanze globale in talks/meta.yaml

Così poi gli si possono dare dei nomi decenti invece di A,B,C
boyska 5 years ago
parent
commit
d889b610a4
2 changed files with 10 additions and 1 deletions
  1. 6 1
      plugins/talks.py
  2. 4 0
      talks/meta.yaml

+ 6 - 1
plugins/talks.py

@@ -97,6 +97,8 @@ def get_global_data():
     if 'startdate' not in data:
         logging.error("Missing startdate in global data")
         data['startdate'] = datetime.datetime.now()
+    if 'rooms' not in data:
+        data['rooms'] = {}
     return data
 
 
@@ -143,6 +145,9 @@ def get_talk_data(talkname):
             data['needs'] = []
         if 'room' not in data:
             logging.warn("Talk <{}> has no `room` field".format(talkname))
+        else:
+            if data['room'] in get_global_data()['rooms']:
+                data['room'] = get_global_data()['rooms'][data['room']]
         if 'time' not in data or 'day' not in data:
             logging.warn("Talk <{}> has no `time` or `day`".format(talkname))
             if 'time' in data:
@@ -305,7 +310,7 @@ class TalkGridDirective(Directive):
                         rooms.add(r)
                 else:
                     rooms.add(t['room'])
-            rooms = list(sorted(rooms))
+            rooms = list(sorted(rooms))  # TODO: ordina in base a qualcosa nel meta.yaml globale
             # room=* is not a real room.
             # Remove it unless that day only has special rooms
             if '*' in rooms and len(rooms) > 1:

+ 4 - 0
talks/meta.yaml

@@ -1 +1,5 @@
 startdate: 2018-07-05
+rooms:
+    A: Sala A
+    B: Sala B
+    C: Sala C