Mercurial > p > roundup > code
comparison roundup/configuration.py @ 2620:92c820cfcc4a
cannot import roundup.instance because of import loop.
hence cannot raise TrackerError defined in that module.
instead, raise OptionValueError if standard python logging is
requested but unavailable.
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Sun, 25 Jul 2004 13:12:59 +0000 |
| parents | 4b4ca3bd086b |
| children | 5a27c34e99ef |
comparison
equal
deleted
inserted
replaced
| 2619:4b4ca3bd086b | 2620:92c820cfcc4a |
|---|---|
| 1 # Roundup Issue Tracker configuration support | 1 # Roundup Issue Tracker configuration support |
| 2 # | 2 # |
| 3 # $Id: configuration.py,v 1.2 2004-07-25 12:44:16 a1s Exp $ | 3 # $Id: configuration.py,v 1.3 2004-07-25 13:12:59 a1s Exp $ |
| 4 # | 4 # |
| 5 __docformat__ = "restructuredtext" | 5 __docformat__ = "restructuredtext" |
| 6 | 6 |
| 7 import imp | 7 import imp |
| 8 import os | 8 import os |
| 9 import time | 9 import time |
| 10 import ConfigParser | 10 import ConfigParser |
| 11 | 11 |
| 12 from roundup import instance, rlog | 12 from roundup import rlog |
| 13 # XXX i don't think this module needs string translation, does it? | 13 # XXX i don't think this module needs string translation, does it? |
| 14 | 14 |
| 15 ### Exceptions | 15 ### Exceptions |
| 16 | 16 |
| 17 class ConfigurationError(Exception): | 17 class ConfigurationError(Exception): |
| 541 _file = self["LOGGING_CONFIG"] | 541 _file = self["LOGGING_CONFIG"] |
| 542 if _file and os.path.isfile(_file): | 542 if _file and os.path.isfile(_file): |
| 543 try: | 543 try: |
| 544 import logging | 544 import logging |
| 545 _logging = logging | 545 _logging = logging |
| 546 except ImportError, msg: | 546 except ImportError, _err: |
| 547 raise instance.TrackerError, \ | 547 _option = self._get_option("LOGGING_CONFIG") |
| 548 'Python logging module unavailable: %s' % msg | 548 raise OptionValueError(_option, _file, |
| 549 "Python logging module is not available: %s" % _err) | |
| 549 _logging.fileConfig(_file) | 550 _logging.fileConfig(_file) |
| 550 else: | 551 else: |
| 551 _logging = rlog.BasicLogging() | 552 _logging = rlog.BasicLogging() |
| 552 _file = self["LOGGING_FILENAME"] | 553 _file = self["LOGGING_FILENAME"] |
| 553 if _file: | 554 if _file: |
