diff options
author | Richard Darst <rkd@zgib.net> | 2009-09-05 02:18:56 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-09-05 02:18:56 (GMT) |
commit | 1fd37b030165a3bbae5dc42d398441ecb15660d3 (patch) | |
tree | f8d7f203b03fa23dc88e5786b115c9ed01b0f891 | |
parent | f9f3fb0e0bc771931d476cab32dc0ee50e6eccc1 (diff) |
Add safeMode to the Config class, also doc changes
- safeMode is a variable not designed to be user set which enables a
"recovery mode". With this mode, MeetBot will try harder to not let
exceptions propogate and have a command fail.
- This is good for live meetings, where failure means it loses data.
- This is not good for interactive command usage (like replaying logs),
since if it breaks you will notice it immediately and can re-run it.
- As such, safe mode is by default off, except when run from the supybot
plugin where it defaults to on.
- Some misc doc changes, in the comments in the Config class.
darcs-hash:20090905021856-82ea9-f35a0e382faf274a7f834315cd6fcd9079524ed4.gz
-rw-r--r-- | meeting.py | 14 | ||||
-rw-r--r-- | plugin.py | 1 |
2 files changed, 11 insertions, 4 deletions
@@ -94,14 +94,18 @@ class Config(object): "Minutes: %(urlBasename)s.html\n" "Minutes (text): %(urlBasename)s.txt\n" "Log: %(urlBasename)s.log.html") + # Input/output codecs. input_codec = 'utf-8' output_codec = 'utf-8' - update_realtime = True + # Functions to do the i/o conversion. def enc(self, text): return text.encode(self.output_codec, 'replace') def dec(self, text): return text.decode(self.input_codec, 'replace') + # Write out select logfiles + update_realtime = True + # This tells which writers write out which to extensions. writer_map = { '.log.html':writers.HTMLlog, #'.1.html': writers.HTML, @@ -112,7 +116,7 @@ class Config(object): } - def __init__(self, M, writeRawLog=False): + def __init__(self, M, writeRawLog=False, safeMode=False): self.M = M self.writers = { } @@ -122,6 +126,7 @@ class Config(object): self.writers['.log.txt'] = writers.TextLog(self.M) for extension, writer in self.writer_map.iteritems(): self.writers[extension] = writer(self.M) + self.safeMode = safeMode def filename(self, url=False): # provide a way to override the filename. If it is # overridden, it must be a full path (and the URL-part may not @@ -402,8 +407,9 @@ class Meeting(MeetingCommands, object): _restrictlogs = False def __init__(self, channel, owner, oldtopic=None, filename=None, writeRawLog=False, - setTopic=None, sendReply=None, getRegistryValue=None): - self.config = Config(self, writeRawLog=writeRawLog) + setTopic=None, sendReply=None, getRegistryValue=None, + safeMode=False): + self.config = Config(self, writeRawLog=writeRawLog, safeMode=safeMode) if getRegistryValue is not None: self._registryValue = getRegistryValue if sendReply is not None: @@ -103,6 +103,7 @@ class MeetBot(callbacks.Plugin): writeRawLog=True, setTopic = _setTopic, sendReply = _sendReply, getRegistryValue = self.registryValue, + safeMode=True ) meeting_cache[Mkey] = M recent_meetings.append( |