equal
deleted
inserted
replaced
12 platform-specific details from the core. |
12 platform-specific details from the core. |
13 """ |
13 """ |
14 |
14 |
15 from i18n import _ |
15 from i18n import _ |
16 import cStringIO, errno, re, shutil, sys, tempfile, traceback, error |
16 import cStringIO, errno, re, shutil, sys, tempfile, traceback, error |
17 import os, stat, threading, time, calendar, ConfigParser, glob, osutil |
17 import os, stat, threading, time, calendar, glob, osutil |
18 import imp |
18 import imp |
19 |
19 |
20 # Python compatibility |
20 # Python compatibility |
21 |
21 |
22 _md5 = None |
22 _md5 = None |
115 "%Y", |
115 "%Y", |
116 "%Y-%m", |
116 "%Y-%m", |
117 "%b", |
117 "%b", |
118 "%b %Y", |
118 "%b %Y", |
119 ) |
119 ) |
120 |
|
121 # differences from SafeConfigParser: |
|
122 # - case-sensitive keys |
|
123 # - allows values that are not strings (this means that you may not |
|
124 # be able to save the configuration to a file) |
|
125 class configparser(ConfigParser.SafeConfigParser): |
|
126 def optionxform(self, optionstr): |
|
127 return optionstr |
|
128 |
|
129 def set(self, section, option, value): |
|
130 return ConfigParser.ConfigParser.set(self, section, option, value) |
|
131 |
|
132 def _interpolate(self, section, option, rawval, vars): |
|
133 if not isinstance(rawval, basestring): |
|
134 return rawval |
|
135 return ConfigParser.SafeConfigParser._interpolate(self, section, |
|
136 option, rawval, vars) |
|
137 |
120 |
138 def cachefunc(func): |
121 def cachefunc(func): |
139 '''cache the result of function calls''' |
122 '''cache the result of function calls''' |
140 # XXX doesn't handle keywords args |
123 # XXX doesn't handle keywords args |
141 cache = {} |
124 cache = {} |