Browse Source

allow example config to be in CWD or CWD/pyfpdb on posix

master
Steffen Schaumburg 13 years ago
parent
commit
58f656f374
  1. 7
      pyfpdb/Configuration.py

7
pyfpdb/Configuration.py

@ -104,6 +104,11 @@ def get_config(file_name, fallback = True):
# the config directory for us so there's no need to check it
# again
example_path = '/usr/share/python-fpdb/' + file_name + '.example'
if not os.path.exists(example_path):
if os.path.exists(file_name + '.example'):
example_path = file_name + '.example'
else:
example_path = "pyfpdb/" + file_name + '.example'
if not config_found and fallback:
try:
shutil.copyfile(example_path, config_path)
@ -735,7 +740,7 @@ class Config:
#sys.exc_info = (<class 'xml.parsers.expat.ExpatError'>, ExpatError('not well-formed (invalid token): line 511,
# column 4',), <traceback object at 0x024503A0>)
if not self.example_copy and example_file is not None:
if (not self.example_copy) and (example_file is not None):
# reads example file and adds missing elements into current config
added = self.add_missing_elements(doc, example_file)

Loading…
Cancel
Save