Merge branch 'master' of git://git.assembla.com/fpdb-sql

This commit is contained in:
Eratosthenes 2010-02-22 11:46:56 -05:00
commit 38535b4ece
2 changed files with 16 additions and 3 deletions

View File

@ -482,12 +482,19 @@ class Config:
print "\nReading configuration file %s\n" % file
try:
doc = xml.dom.minidom.parse(file)
self.file_error = None
except:
log.error("Error parsing %s. See error log file." % (file))
traceback.print_exc(file=sys.stderr)
print "press enter to continue"
sys.stdin.readline()
sys.exit()
self.file_error = sys.exc_info()[1]
# we could add a parameter to decide whether to return or read a line and exit?
return
#print "press enter to continue"
#sys.stdin.readline()
#sys.exit()
#ExpatError: not well-formed (invalid token): line 511, column 4
#sys.exc_info = (<class 'xml.parsers.expat.ExpatError'>, ExpatError('not well-formed (invalid token): line 511,
# column 4',), <traceback object at 0x024503A0>)
self.doc = doc
self.supported_sites = {}

View File

@ -688,6 +688,12 @@ class fpdb:
def load_profile(self):
"""Loads profile from the provided path name."""
self.config = Configuration.Config(file=options.config, dbname=options.dbname)
if self.config.file_error:
self.warning_box( "There is an error in your config file\n" + self.config.file
+ "\n\nError is: " + str(self.config.file_error)
, diatitle="CONFIG FILE ERROR" )
exit()
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
if self.config.example_copy: