From ba0d5ab285793bf943bcd76473e1ce657a93e9ac Mon Sep 17 00:00:00 2001 From: tcely Date: Thu, 12 Dec 2024 13:33:17 -0500 Subject: [PATCH] Regex and syntax tweaks I didn't pay close enough attention to the try grammar. --- tubesync/tubesync/sqlite3/base.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tubesync/tubesync/sqlite3/base.py b/tubesync/tubesync/sqlite3/base.py index e4dfbcb8..bee1b3f4 100644 --- a/tubesync/tubesync/sqlite3/base.py +++ b/tubesync/tubesync/sqlite3/base.py @@ -28,16 +28,15 @@ class DatabaseWrapper(base.DatabaseWrapper): def _remove_invalid_keyword_argument(self, params): try: - prog = re.compile(r"^'(?P[^']+)' is an invalid keyword argument for Connection[()]{2}$") + prog = re.compile(r"^(?P['])(?P[^']+)(?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