tried my best to write a clearer comment + simplified finding out of what the selected database is
This commit is contained in:
parent
cb16dde365
commit
8f2a2c20cc
|
@ -385,25 +385,19 @@ class Config:
|
||||||
game = Game(node = game_node)
|
game = Game(node = game_node)
|
||||||
self.supported_games[game.game_name] = game
|
self.supported_games[game.game_name] = game
|
||||||
|
|
||||||
|
# parse databases defined by user in the <supported_databases> section
|
||||||
|
# the user may select the actual database to use via commandline or by setting the selected="bool"
|
||||||
|
# attribute of the tag. if no database is explicitely selected, we use the first one we come across
|
||||||
# s_dbs = doc.getElementsByTagName("supported_databases")
|
# s_dbs = doc.getElementsByTagName("supported_databases")
|
||||||
# select database from those defined in config by:
|
|
||||||
# 1) command line option
|
|
||||||
# or 2) selected="True" in config element
|
|
||||||
# or 3) just choose the first we come across
|
|
||||||
#TODO: do we want to take all <database> tags or all <database> tags contained in <supported_databases>
|
#TODO: do we want to take all <database> tags or all <database> tags contained in <supported_databases>
|
||||||
# ..this may break stuff for some users. so leave it unchanged for now untill there is a decission
|
# ..this may break stuff for some users. so leave it unchanged for now untill there is a decission
|
||||||
for db_node in doc.getElementsByTagName("database"):
|
for db_node in doc.getElementsByTagName("database"):
|
||||||
db = Database(node=db_node)
|
db = Database(node=db_node)
|
||||||
if db.db_name in self.supported_databases:
|
if db.db_name in self.supported_databases:
|
||||||
raise FpdbError("Database names must be unique")
|
raise FpdbError("Database names must be unique")
|
||||||
# If there is only one Database node, or none are marked
|
if self.db_selected is None or db.db_selected:
|
||||||
# default, use first
|
|
||||||
# default, use first
|
|
||||||
if not self.supported_databases:
|
|
||||||
self.db_selected = db.db_name
|
self.db_selected = db.db_name
|
||||||
self.supported_databases[db.db_name] = db
|
self.supported_databases[db.db_name] = db
|
||||||
if db.db_selected:
|
|
||||||
self.db_selected = db.db_name
|
|
||||||
|
|
||||||
if dbname and dbname in self.supported_databases:
|
if dbname and dbname in self.supported_databases:
|
||||||
self.db_selected = dbname
|
self.db_selected = dbname
|
||||||
|
|
Loading…
Reference in New Issue
Block a user