@@ -968,28 +968,31 @@ def loadConfigFile(fileName):
968
968
JOIN doc_type t
969
969
ON t.id = v.doc_type
970
970
WHERE t.name = 'SweepSpecifications'
971
- AND v.val_status = 'V'""" )
971
+ AND v.val_status = 'V'
972
+ GROUP BY v.id""" )
972
973
rows = cursor .fetchall ()
973
974
if len (rows ) > 1 :
974
975
fatalError ("More than on SweepSpecifications document found" )
975
976
elif len (rows ) == 1 :
976
- cursor .execute ("""\
977
- SELECT xml
978
- FROM doc_version
979
- WHERE id = ?
980
- AND num = ?""" , tuple (row ))
981
- xml = cursor .fetchone ()[0 ]
977
+ doc_id , version = rows [0 ]
978
+ query = cdrdb .Query ("doc_version" , "xml" )
979
+ query .where (query .Condition ("id" , doc_id ))
980
+ query .where (query .Condition ("num" , version ))
981
+ row = query .execute (cursor ).fetchone ()
982
982
try :
983
- dom = xml .dom .minidom .parseString (xml .encode ("utf-8" ))
983
+ dom = xml .dom .minidom .parseString (row [0 ].encode ("utf-8" ))
984
+ args = doc_id , version
985
+ log ("loaded config from CDR{:d} version {:d}" .format (* args ))
984
986
except Exception as e :
985
987
msg = "Failure parsing config document CDR{:d} version {:d}: {}"
986
- args = row [ 0 ], row [ 1 ] , e
988
+ args = doc_id , version , e
987
989
fatalError (msg .format (* args ))
988
990
989
991
# Otherwise, parse file from disk (temporary fallback)
990
992
else :
991
993
try :
992
994
dom = xml .dom .minidom .parse (fileName )
995
+ log ("loaded config from {}" .format (fileName ))
993
996
except Exception , info :
994
997
fatalError ("Error loading config file %s: %s" % (fileName , info ))
995
998
0 commit comments