From 573b40f76a1692f87a0eb80120cab5f7b3bf6cee Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 11 Jan 2011 18:47:06 +0100 Subject: tracking: Moved confliction code to lc_callback(). --- modules/tracking.py | 20 ++++++++++---------- 1 file 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() -- cgit v1.2.3