1
2
3 """Pylons (and thus TurboGears 2) helper functions."""
4
5
6 import atexit
7 import re
8
9 from paste.deploy.converters import asbool
10 from pylons import config
11
12 from turbomail.control import interface
13
14
15 __all__ = ['start_extension', 'shutdown_extension']
16
17
18
20 """TODO: Docstring incomplete."""
21
23 self._config = real_config
24 self._nr_regex = re.compile('^(\d+)$')
25
26 - def get(self, option, default):
27 value = self._config.get(option, default)
28 return self._convert(option, value)
29
31 if value is not None:
32 boolean_options = (
33 'mail.smtp.tls',
34 'mail.tls',
35 'mail.smtp.debug',
36 'mail.debug'
37 )
38
39 should_be_bool = (option.endswith('.on') or (option in boolean_options))
40
41 if should_be_bool:
42 value = asbool(value)
43
44 elif hasattr(value, 'isdigit') and value.isdigit():
45 value = int(value)
46
47 return value
48
49 - def update(self, new_value_dict):
50 self._config.update(new_value_dict)
51
52
60
61
64