Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def genConnXML(d):
""" Receive a dict containing connection info, and return
a 'connection' XML element.
"""
try:
if "name" not in d:
if not d["user"]:
d["user"] = "anybody"
if not d["host"]:
d["host"] = "local"
d["name"] = "%s@%s" % (d["user"], d["host"])
ret = getConnTemplate() % (escQuote(d["dbtype"], noQuote=True),
escQuote(d["name"], noQuote=True), escQuote(d["host"], noQuote=True),
escQuote(d["database"], noQuote=True), escQuote(d["user"], noQuote=True),
escQuote(d["password"], noQuote=True), d["port"])
except KeyError:
# Not a valid conn info dict
ret = ""
return ret
### pkm: I'm pretty sure we want to remove the above try block and propagate
def genConnXML(d):
""" Receive a dict containing connection info, and return
a 'connection' XML element.
"""
try:
if "name" not in d:
if not d["user"]:
d["user"] = "anybody"
if not d["host"]:
d["host"] = "local"
d["name"] = "%s@%s" % (d["user"], d["host"])
ret = getConnTemplate() % (escQuote(d["dbtype"], noQuote=True),
escQuote(d["name"], noQuote=True), escQuote(d["host"], noQuote=True),
escQuote(d["database"], noQuote=True), escQuote(d["user"], noQuote=True),
escQuote(d["password"], noQuote=True), d["port"])
except KeyError:
# Not a valid conn info dict
ret = ""
return ret
### pkm: I'm pretty sure we want to remove the above try block and propagate