diff options
-rw-r--r-- | modules/tracking.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/tracking.py b/modules/tracking.py index 81c4fd1..0d34b17 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -293,6 +293,15 @@ class Module: consignment = session.query(Consignment).filter(Consignment.code == code).one() self.update_consignment(session, consignment, announce) session.commit() + except IntegrityError as e: + # assume several packets within the same consignment was added as a consignment + target = consignment.channel or consignment.nick + target = target.encode('utf-8') + session.rollback() + session.delete(consignment) + session.commit() + if announce: + self.irc.msg(target, '%s: \002%s\002 conflicts with another consignment - tracking stopped' % (target, code)) finally: session.close() |