diff options
author | Richard Darst <rkd@zgib.net> | 2009-06-26 03:10:06 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-06-26 03:10:06 (GMT) |
commit | aac4ff07f0e90afca6ee1a5001f91d63dc1d3fa9 (patch) | |
tree | 844ba10cd92f7b7b55be256670c60bb73908378f /meeting.py | |
parent | 0441fa708fed4cc2c72dd1fb97c18aa6be0aa9f5 (diff) |
move writer configuration to main class ; other rearrangement
- writer_map is now a class property for easy configuration.
- move functions and data related to __main__ scripts to the end.
darcs-hash:20090626031006-82ea9-f29cb81e7db8f6d6f2ca2e3e9b9c50fef0672a03.gz
Diffstat (limited to 'meeting.py')
-rw-r--r-- | meeting.py | 53 |
1 files changed, 28 insertions, 25 deletions
@@ -36,6 +36,10 @@ import stat import pygments +import writers ; reload(writers) +import items ; reload(items) +from items import Topic, Info, Idea, Agreed, Action, Halp, Accepted, Rejected, Link + class Config(object): # @@ -129,19 +133,17 @@ class Config(object): def basename(self): return os.path.basename(self.filename()) + writer_map = { + '.log.html':writers.HTMLlog(), + '.html': writers.HTML(), + '.txt': writers.RST(), + #'.rst.html':writers.HTMLfromRST(), + } def save(self): """Write all output files.""" - import writers - - writer_map = { - '.log.html':writers.HTMLlog(), - '.html': writers.HTML(), - '.rst': writers.RST(), - '.rst.html':writers.HTMLfromRST(), - } if self.M._writeRawLog: - writer_map['.log.txt'] = writers.TextLog() - for extension, writer in writer_map.iteritems(): + self.writer_map['.log.txt'] = writers.TextLog() + for extension, writer in self.writer_map.iteritems(): rawname = self.filename() text = writer.format(self.M) f = open(rawname+extension, 'w') @@ -154,23 +156,12 @@ class Config(object): newmode = os.stat(f.name).st_mode & (~self.RestrictPerm) os.chmod(f.name, newmode) + + # Set the timezone, using the variable above os.environ['TZ'] = Config.timeZone time.tzset() -def parse_time(time_): - try: return time.strptime(time_, "%H:%M:%S") - except ValueError: pass - try: return time.strptime(time_, "%H:%M") - except ValueError: pass -logline_re = re.compile(r'\[?([0-9: ]*)\]? *<[@+]?([^>]+)> *(.*)') -loglineAction_re = re.compile(r'\[?([0-9: ]*)\]? *\* *([^ ]+) *(.*)') - - -import writers ; reload(writers) -import items ; reload(items) -from items import Topic, Info, Idea, Agreed, Action, Halp, Accepted, Rejected, Link - # load custom local configurations try: import meetingLocalConfig @@ -180,6 +171,8 @@ try: except ImportError: pass + + class MeetingCommands(object): # Command Definitions # generic parameters to these functions: @@ -348,8 +341,6 @@ class MeetingCommands(object): - - class Meeting(MeetingCommands, object): _lurk = False _restrictlogs = False @@ -439,6 +430,18 @@ class Meeting(MeetingCommands, object): linenum=linenum, time_=time_) + + +def parse_time(time_): + try: return time.strptime(time_, "%H:%M:%S") + except ValueError: pass + try: return time.strptime(time_, "%H:%M") + except ValueError: pass +logline_re = re.compile(r'\[?([0-9: ]*)\]? *<[@+]?([^>]+)> *(.*)') +loglineAction_re = re.compile(r'\[?([0-9: ]*)\]? *\* *([^ ]+) *(.*)') + + + # None of this is very well refined. if __name__ == '__main__': import sys |