From 74cb5acd5f09b4b0ee9c321a4426a7058c3cdd4e Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 27 May 2015 21:40:50 +0000 Subject: [PATCH] Allow extra settings for meetings to be used in templates Besides looking for the required values, allow any extra values to be saved and referenced from templates. Change-Id: I7395a92f447aee943da54aa0439dd0c683da176a --- README.rst | 13 +++++++++++++ yaml2ical/meeting.py | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/README.rst b/README.rst index d1167a2..42158aa 100644 --- a/README.rst +++ b/README.rst @@ -120,6 +120,11 @@ The file name should be a lower-cased, hyphenated version of the meeting name, ending with ``.yaml`` . For example, ``Keystone team meeting`` should be saved under ``keystone-team-meeting.yaml``. +Any other values listed in the YAML file are also available for use in +templates, making it easy to build links to agenda pages for the +meeting or logs of past meetings. In the template file, use +``meeting.extras.name`` to access the value. + Example ------- @@ -165,3 +170,11 @@ will be import into Python as a dictionary. This meeting is a weekly gathering of developers working on OpenStack. Compute (Nova). We cover topics such as release planning and status, bugs, reviews, and other current topics worthy of real-time discussion. + +* An extra property containing the agenda for the meeting is saved in + ``agenda_url`` and can be accessed in the template file as + ``meeting.extras.agenda_url``. + + :: + + agenda_url: https://wiki.openstack.org/wiki/Meetings/Nova diff --git a/yaml2ical/meeting.py b/yaml2ical/meeting.py index 5d3603c..c4f3777 100644 --- a/yaml2ical/meeting.py +++ b/yaml2ical/meeting.py @@ -67,6 +67,14 @@ class Meeting(object): "attribute '{0}'".format(e.args[0])) raise + # Find any extra values the user has provided that they might + # want to have access to in their templates. + self.extras = {} + self.extras.update(yaml_obj) + for k in ['chair', 'description', 'project', 'schedule']: + if k in self.extras: + del self.extras[k] + try: self.filefrom = os.path.basename(data.name) except AttributeError: