summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-01-11 15:59:23 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-01-11 15:59:23 +0100
commit66fd3fabe7b16abb0fa61b680067921398ad1f7e (patch)
tree2d453c19a23e7bae52c16762b18886d0d35ffa6e /modules
parent27d06845ef191f9224de9dbadf12b51838b45e9a (diff)
tracking: Attempt to detect and remove conflicting consignments.
Diffstat (limited to 'modules')
-rw-r--r--modules/tracking.py9
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()