13 """ |
13 """ |
14 |
14 |
15 from i18n import gettext as _ |
15 from i18n import gettext as _ |
16 from demandload import * |
16 from demandload import * |
17 demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") |
17 demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") |
18 demandload(globals(), "os threading time calendar") |
18 demandload(globals(), "os threading time calendar ConfigParser") |
19 |
19 |
20 # used by parsedate |
20 # used by parsedate |
21 defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', |
21 defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', |
22 '%a %b %d %H:%M:%S %Y') |
22 '%a %b %d %H:%M:%S %Y') |
23 |
23 |
24 class SignalInterrupt(Exception): |
24 class SignalInterrupt(Exception): |
25 """Exception raised on SIGTERM and SIGHUP.""" |
25 """Exception raised on SIGTERM and SIGHUP.""" |
|
26 |
|
27 # like SafeConfigParser but with case-sensitive keys |
|
28 class configparser(ConfigParser.SafeConfigParser): |
|
29 def optionxform(self, optionstr): |
|
30 return optionstr |
26 |
31 |
27 def cachefunc(func): |
32 def cachefunc(func): |
28 '''cache the result of function calls''' |
33 '''cache the result of function calls''' |
29 # XXX doesn't handle keywords args |
34 # XXX doesn't handle keywords args |
30 cache = {} |
35 cache = {} |