def open_database(filename): cc = None # Parse the configuration file to get the database URI. print("Opening configuration file: %s" % filename) cl = CrashLogger() options = cl.read_config_file(filename) # Open the database. try: if not options.database: print("Warning: no database configured here, ignored") return elif options.database.startswith('dbm://'): dbfile = options.database[6:] print("Connecting to DBM database file: %s" % dbfile) cc = CrashContainer(dbfile) else: print("Connecting to database: %s" % options.database) cc = CrashDictionary(options.database) except Exception as e: print("Error connecting to the database: %s" % e) return # Return the crash container. return cc
def open_database(filename): cc = None # Parse the configuration file to get the database URI. print "Opening configuration file: %s" % filename cl = CrashLogger() options = cl.read_config_file(filename) # Open the database. try: if not options.database: print "Warning: no database configured here, ignored" return elif options.database.startswith('dbm://'): dbfile = options.database[6:] print "Connecting to DBM database file: %s" % dbfile cc = CrashContainer(dbfile) else: print "Connecting to database: %s" % options.database cc = CrashDictionary(options.database) except Exception, e: print "Error connecting to the database: %s" % e return