diff options
author | Richard Darst <rkd@zgib.net> | 2009-11-24 07:15:05 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-11-24 07:15:05 (GMT) |
commit | c0f4d2e5c816af43af9fe128b002bb73cf8b789b (patch) | |
tree | 9512321b133e27ab5a51aa5032cf79e62396ea23 | |
parent | 4c0838bd1877346bde10a6a6963747c8c92acdcb (diff) |
Separate start/endmeeting variables into a replacements method
- The logic of generating replacement variables is only in one spot now.
darcs-hash:20091124071505-82ea9-1e7c37da96e9463c29bfb32ee5eb81c8c5b3acea.gz
-rw-r--r-- | meeting.py | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -265,13 +265,8 @@ class MeetingCommands(object): # Commands for Chairs: def do_startmeeting(self, nick, time_, line, **kwargs): """Begin a meeting.""" - starttime = time.asctime(time_) self.starttime = time_ - timeZone = self.config.timeZone - chair = self.owner - MeetBotInfoURL = self.config.MeetBotInfoURL - repl = locals() - repl['__version__'] = __version__ + repl = self.replacements() message = self.config.startMeetingMessage%repl for messageline in message.split('\n'): self.reply(messageline) @@ -284,12 +279,7 @@ class MeetingCommands(object): self.topic(self.oldtopic) self.endtime = time_ self.config.save() - endtime = time.asctime(time_) - timeZone = self.config.timeZone - urlBasename = self.config.filename(url=True) - MeetBotInfoURL = self.config.MeetBotInfoURL - repl = locals() - repl['__version__'] = __version__ + repl = self.replacements() message = self.config.endMeetingMessage%repl for messageline in message.split('\n'): self.reply(messageline) @@ -548,6 +538,20 @@ class Meeting(MeetingCommands, object): """Add an item to the meeting minutes list. """ self.minutes.append(m) + def replacements(self): + repl = { } + repl['MeetBotInfoURL'] = self.config.MeetBotInfoURL + repl['timeZone'] = self.config.timeZone + repl['starttime'] = repl['endtime'] = "None" + if getattr(self, "starttime", None) is not None: + repl['starttime'] = time.asctime(self.starttime) + if getattr(self, "endtime", None) is not None: + repl['endtime'] = time.asctime(self.endtime) + repl['__version__'] = __version__ + repl['chair'] = self.owner + repl['urlBasename'] = self.config.filename(url=True) + return repl + |