Regex and syntax tweaks

I didn't pay close enough attention to the try grammar.
This commit is contained in:
tcely 2024-12-12 13:33:17 -05:00 committed by GitHub
parent 36b395ae30
commit ba0d5ab285
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,16 +28,15 @@ class DatabaseWrapper(base.DatabaseWrapper):
def _remove_invalid_keyword_argument(self, params):
try:
prog = re.compile(r"^'(?P<key>[^']+)' is an invalid keyword argument for Connection[()]{2}$")
prog = re.compile(r"^(?P<quote>['])(?P<key>[^']+)(?P=quote) is an invalid keyword argument for Connection\(\)$")
match = prog.match(e.args[0])
else:
if match:
key = match.group('key')
try:
# remove the invalid keyword argument
del params[key]
else:
return True
if match:
key = match.group('key')
try:
# remove the invalid keyword argument
del params[key]
return True
return False