Regex and syntax tweaks

I didn't pay close enough attention to the try grammar.
This commit is contained in:
tcely authored and GitHub committed 2024-12-12 13:33:17 -05:00
1 parent 36b395ae30
commit ba0d5ab285
1 file changed
+2 -3
+2 -3
View File
@@ -28,15 +28,14 @@ class DatabaseWrapper(base.DatabaseWrapper):
def _remove_invalid_keyword_argument(self, params): def _remove_invalid_keyword_argument(self, params):
try: 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]) match = prog.match(e.args[0])
else:
if match: if match:
key = match.group('key') key = match.group('key')
try: try:
# remove the invalid keyword argument # remove the invalid keyword argument
del params[key] del params[key]
else:
return True return True
return False return False