From 2cbd564f092b87aff5638772e35501fae8d920d3 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 8 Jan 2007 02:23:04 +0000 Subject: [PATCH] moved some constants to the right scope --- src/cryptobox/core/settings.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/cryptobox/core/settings.py b/src/cryptobox/core/settings.py index 9d7931b..335b8d5 100644 --- a/src/cryptobox/core/settings.py +++ b/src/cryptobox/core/settings.py @@ -31,20 +31,20 @@ import configobj, validate import syslog +CONF_LOCATIONS = [ + "./cryptobox.conf", + "~/.cryptobox.conf", + "/etc/cryptobox-server/cryptobox.conf"] + +VOLUMESDB_FILE = "cryptobox_volumes.db" +PLUGINCONF_FILE = "cryptobox_plugins.conf" +USERDB_FILE = "cryptobox_users.db" + + class CryptoBoxSettings: """Manage the various configuration files of the CryptoBox """ - CONF_LOCATIONS = [ - "./cryptobox.conf", - "~/.cryptobox.conf", - "/etc/cryptobox-server/cryptobox.conf"] - - VOLUMESDB_FILE = "cryptobox_volumes.db" - PLUGINCONF_FILE = "cryptobox_plugins.conf" - USERDB_FILE = "cryptobox_users.db" - - def __init__(self, config_file=None): self.log = logging.getLogger("CryptoBox") config_file = self.__get_config_filename(config_file) @@ -283,7 +283,7 @@ class CryptoBoxSettings: try: try: plugin_conf_file = os.path.join( - self.prefs["Locations"]["SettingsDir"], self.PLUGINCONF_FILE) + self.prefs["Locations"]["SettingsDir"], PLUGINCONF_FILE) except KeyError: raise CBConfigUndefinedError("Locations", "SettingsDir") except SyntaxError: @@ -312,7 +312,7 @@ class CryptoBoxSettings: try: try: conf_file = os.path.join( - self.prefs["Locations"]["SettingsDir"], self.VOLUMESDB_FILE) + self.prefs["Locations"]["SettingsDir"], VOLUMESDB_FILE) except KeyError: raise CBConfigUndefinedError("Locations", "SettingsDir") except SyntaxError: @@ -339,7 +339,7 @@ class CryptoBoxSettings: try: try: user_db_file = os.path.join( - self.prefs["Locations"]["SettingsDir"], self.USERDB_FILE) + self.prefs["Locations"]["SettingsDir"], USERDB_FILE) except KeyError: raise CBConfigUndefinedError("Locations", "SettingsDir") except SyntaxError: @@ -384,7 +384,7 @@ class CryptoBoxSettings: if config_file is None: # no config file was specified - we will look for it in the ususal locations conf_file_list = [os.path.expanduser(f) - for f in self.CONF_LOCATIONS + for f in CONF_LOCATIONS if os.path.exists(os.path.expanduser(f))] if not conf_file_list: # no possible config file found in the usual locations @@ -653,6 +653,6 @@ class LocalSysLogHandler(logging.Handler): msg = "%s: %s" % (record.levelname, record.getMessage()) try: syslog.syslog(record.levelno, msg) - except: + except Exception: self.handleError(record)