meeting.py - update meetingLocalConfig.py locating logic
Ignore-this: f9f1faa18de17fce6ff5fa7ba2492f1 - Will now look in these places: - $PYTHONPATH (via 'import meetingLocalConfig') - alongside `meeting.py` in the `ircmeeting/` module directory. - $CWD darcs-hash:20101207221721-82ea9-c9ed44b5cb896d2d4dace9a3811985bda65000df.gz
This commit is contained in:
parent
64e0be8341
commit
9fdcb3bb47
@ -259,18 +259,31 @@ os.environ['TZ'] = Config.timeZone
|
|||||||
time.tzset()
|
time.tzset()
|
||||||
|
|
||||||
# load custom local configurations
|
# load custom local configurations
|
||||||
try:
|
LocalConfig = None
|
||||||
import __main__
|
import __main__
|
||||||
if getattr(__main__, 'running_tests', False): raise ImportError
|
# Two conditions where we do NOT load any local configuration files
|
||||||
if 'MEETBOT_RUNNING_TESTS' in os.environ: raise ImportError
|
if getattr(__main__, 'running_tests', False): pass
|
||||||
|
elif 'MEETBOT_RUNNING_TESTS' in os.environ: pass
|
||||||
import meetingLocalConfig
|
else:
|
||||||
meetingLocalConfig = reload(meetingLocalConfig)
|
# First source of config: try just plain importing it
|
||||||
if hasattr(meetingLocalConfig, 'Config'):
|
try:
|
||||||
Config = type('Config', (meetingLocalConfig.Config, Config), {})
|
import meetingLocalConfig
|
||||||
except ImportError:
|
meetingLocalConfig = reload(meetingLocalConfig)
|
||||||
pass
|
if hasattr(meetingLocalConfig, 'Config'):
|
||||||
|
LocalConfig = meetingLocalConfig.Config
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
if LocalConfig is None:
|
||||||
|
for dirname in (os.path.dirname("__file__"), "."):
|
||||||
|
fname = os.path.join(dirname, "meetingLocalConfig.py")
|
||||||
|
if os.access(fname, os.F_OK):
|
||||||
|
meetingLocalConfig = { }
|
||||||
|
execfile(fname, meetingLocalConfig)
|
||||||
|
LocalConfig = meetingLocalConfig["Config"]
|
||||||
|
break
|
||||||
|
if LocalConfig is not None:
|
||||||
|
# Subclass Config and LocalConfig, new type overrides Config.
|
||||||
|
Config = type('Config', (LocalConfig, Config), {})
|
||||||
|
|
||||||
|
|
||||||
class MeetingCommands(object):
|
class MeetingCommands(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user