Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/meeting.py
diff options
context:
space:
mode:
authorRichard Darst <rkd@zgib.net>2009-07-06 23:32:36 (GMT)
committer Richard Darst <rkd@zgib.net>2009-07-06 23:32:36 (GMT)
commit8ff681301eed8c9384c3e015ee989da8661afbe2 (patch)
tree4e1a078f87bef6515038861a2f0f5887cbf4ea6d /meeting.py
parent9db165ab72d1af47996a9f9d2d4e0163517d7ed8 (diff)
Update to config save function to modularize
darcs-hash:20090706233236-82ea9-15f6d87348ed49cb7e3b2f514e6b11e51568396b.gz
Diffstat (limited to 'meeting.py')
-rw-r--r--meeting.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/meeting.py b/meeting.py
index a3e6338..4ea099a 100644
--- a/meeting.py
+++ b/meeting.py
@@ -144,15 +144,31 @@ class Config(object):
}
def save(self):
"""Write all output files."""
+ rawname = self.filename()
+ # We want to write the rawlog (.log.txt) first in case the
+ # other methods break. That way, we have saved enough to
+ # replay.
if self.M._writeRawLog:
- self.writer_map['.log.txt'] = writers.TextLog
+ text = writers.TextLog(self.M).format('.log.txt')
+ self.writeToFile(self.enc(text), rawname+'.log.txt')
for extension, writer in self.writer_map.iteritems():
- rawname = self.filename()
- text = writer(self.M).format()
- f = open(rawname+extension, 'w')
- if self.M._restrictlogs: self.restrictPermissions(f)
- f.write(self.enc(text))
- f.close()
+ text = writer(self.M).format(extension)
+ # If the writer returns a string or unicode object, then
+ # we should write it to a filename with that extension.
+ # If it doesn't, then it's assumed that the write took
+ # care of writing (or publishing or emailing or wikifying)
+ # it itself.
+ if isinstance(text, (str, unicode)):
+ self.writeToFile(self.enc(text), rawname+extension)
+ def writeToFile(self, string, filename):
+ """Write a given string to a file"""
+ # The reason we have this method just for this is to proxy
+ # through the _restrictPermissions logic.
+ f = open(filename, 'w')
+ if self.M._restrictlogs:
+ self.restrictPermissions(f)
+ f.write(string)
+ f.close()
def restrictPermissions(self, f):
"""Remove the permissions given in the variable RestrictPerm."""
f.flush()