summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-01-11 18:47:06 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-01-11 18:47:06 +0100
commit573b40f76a1692f87a0eb80120cab5f7b3bf6cee (patch)
tree83d281be23dd8594e31256a689a102a55db93f19
parent66fd3fabe7b16abb0fa61b680067921398ad1f7e (diff)
tracking: Moved confliction code to lc_callback().
-rw-r--r--modules/tracking.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index 0d34b17..1b7428c 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -293,15 +293,6 @@ 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()
@@ -354,7 +345,16 @@ class Module:
consignments = session.query(Consignment).filter(Consignment.channel.in_(config.get(self.irc.factory.server, 'channels').split()))
for row in consignments:
self.update_consignment(session, row)
- session.commit()
+ try:
+ 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()
+ self.irc.msg(target, '%s: \002%s\002 conflicts with another consignment - tracking stopped' % (target, code))
finally:
session.close()