]> err.no Git - dak/commitdiff
dak/process_policy.py: escape '_' in string passed to SQL LIKE operator later
authorAnsgar Burchardt <ansgar@debian.org>
Sat, 18 Aug 2012 16:43:36 +0000 (18:43 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sat, 18 Aug 2012 16:43:44 +0000 (18:43 +0200)
dak/process_policy.py

index 77bc448a61c692f296b0e32fe12d2dea73ebcaba..8103fd0ba808453e8a63b02aaaa2cfd658648c68 100755 (executable)
@@ -68,6 +68,10 @@ def do_comments(dir, srcqueue, opref, npref, line, fn, transaction):
         else:
             changes_prefix = changes_prefix + '.changes'
 
+        # We need to escape "_" as we use it with the LIKE operator (via the
+        # SQLA startwith) later.
+        changes_prefix = changes_prefix.replace("_", r"\_")
+
         uploads = session.query(PolicyQueueUpload).filter_by(policy_queue=srcqueue) \
             .join(PolicyQueueUpload.changes).filter(DBChange.changesname.startswith(changes_prefix)) \
             .order_by(PolicyQueueUpload.source_id)