Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbochecha <bochecha@fedoraproject.org>2009-09-22 22:43:26 (GMT)
committer bochecha <bochecha@fedoraproject.org>2009-09-22 22:43:26 (GMT)
commite873d2d4436f0133c190c6b091e47d1401d9682b (patch)
tree87879801be75009f3e5615e2ee5108dcf0c13bbd
parent96f41658e31a7db326daf197be9c3ec89f191140 (diff)
Implement a templating system with Genshi
Ignore-this: dc565ec2e3087ffec03d44c8786be875 This commit enables the first steps towards the use of the Genshi templating system. A templating system makes it possible to control totally the formatted output without any Python skills. darcs-hash:20090922224326-fa9d6-899b1080212c02f2ea74bf2b9b7fad82b18e6066.gz
-rw-r--r--writers.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/writers.py b/writers.py
index 2423063..43768fa 100644
--- a/writers.py
+++ b/writers.py
@@ -235,6 +235,7 @@ class _BaseWriter(object):
# ...,
# ]
+ return repl
@@ -247,11 +248,36 @@ class Template(_BaseWriter):
# replacements object, for debugging purposes
#from code import interact ; interact(local=locals())
+ # let's make the data structure easier to use in the template
+ time = { 'start': repl['starttime'], 'end': repl['endtime'], 'timezone': repl['timeZone'] }
+ meeting = { 'title': repl['pageTitle'], 'owner': repl['owner'], 'logs': repl['fullLogsFullURL'] }
+ attendees = [ person for person in repl['PeoplePresent'] ]
+ agenda = [ { 'topic': item['topic'], 'notes': item['items'] } for item in repl['MeetingItems'] ]
+ actions = [ action for action in repl['ActionItems'] ]
+ actions_person = [ { 'nick': attendee['nick'], 'actions': attendee['items'] } for attendee in repl['ActionItemsPerson'] ]
+ meetbot = { 'version': repl['MeetBotVersion'], 'url': repl['MeetBotInfoURL'] }
+
+ from genshi.template import MarkupTemplate
+
+ # hardcoded path to the template file might not be the best thing to do :]
+ minutes_template = 'meeting-minutes-template.html'
+
+ try:
+ f = open(minutes_template, 'r')
- # Add all the genshi code here
+ tmpl = MarkupTemplate(f.read())
+ stream = tmpl.generate(time=time,
+ meeting=meeting,
+ attendees=attendees,
+ agenda=agenda,
+ actions=actions,
+ actions_person=actions_person,
+ meetbot=meetbot)
+ finally:
+ f.close()
- return '' # This should return the final string to write
+ return stream.render()