summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2012-12-17 22:29:43 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2012-12-17 22:29:43 +0100
commit46a0c6ee1c2655e3d7823b02866417ba50032287 (patch)
treec7b5da87fb8e584238d63443f26a581b1dabb66b
parentd601b937bf6513ad171016c834a4bfc4e9605a46 (diff)
tracking: Also filter by package codes when stopping trackings.
-rw-r--r--modules/tracking.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index aaa0304..6fa01d7 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -220,11 +220,15 @@ class Module:
msg = None
try:
session = Session()
- consignments = session.query(Consignment).filter(and_(Consignment.server == self.irc.factory.server,
- or_(Consignment.code == code, Consignment.label == code)))
+ consignments = session.query(Consignment).outerjoin(Consignment.packages) \
+ .filter(and_(Consignment.server == self.irc.factory.server,
+ or_(Consignment.code == code, Consignment.label == code, Package.code == code)))
if nick:
consignments = consignments.filter(Consignment.nick == nick)
deleted = []
+ consignments = consignments.all()
+ if not len(consignments):
+ raise NoResultFound
# we should have exactly one consignment, but need to handle cases when there are more
for consignment in consignments:
code = str(consignment)