Return-Path: X-Original-To: apmail-allura-commits-archive@www.apache.org Delivered-To: apmail-allura-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 36E65116D7 for ; Wed, 21 May 2014 14:44:50 +0000 (UTC) Received: (qmail 52138 invoked by uid 500); 21 May 2014 14:44:50 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 52102 invoked by uid 500); 21 May 2014 14:44:50 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 52090 invoked by uid 99); 21 May 2014 14:44:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 May 2014 14:44:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DAEA699C0B3; Wed, 21 May 2014 14:44:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: commits@allura.apache.org Date: Wed, 21 May 2014 14:44:56 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [08/20] git commit: [#7257] ticket:562 Made extension log exceptions and fail silently [#7257] ticket:562 Made extension log exceptions and fail silently Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0df1dea7 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0df1dea7 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0df1dea7 Branch: refs/heads/master Commit: 0df1dea7e953cb1eebf61cce6008306acb3729a1 Parents: e674b0b Author: Ferens Dmitriy Authored: Thu Apr 3 12:49:06 2014 +0300 Committer: Dave Brondsema Committed: Wed May 21 14:44:20 2014 +0000 ---------------------------------------------------------------------- Allura/allura/model/session.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/0df1dea7/Allura/allura/model/session.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/session.py b/Allura/allura/model/session.py index b2abf3b..2d60afa 100644 --- a/Allura/allura/model/session.py +++ b/Allura/allura/model/session.py @@ -67,26 +67,31 @@ class IndexerSessionExtension(ManagedSessionExtension): result[class_path].append(obj) return result - def _add_to_index(self, tasks, obj_list): - task = tasks.get('add') - if task: task.post([o._id for o in obj_list]) + def _index_action(self, tasks, obj_list, action): + task = tasks.get(action) + if task: + if action == 'add': + args = ([o._id for o in obj_list],) + else: + args = ([o.index_id() for o in obj_list],) + + try: + task.post(*args) + except: + log.error('Error calling %s', task.__name__) - def _del_from_index(self, tasks, obj_list): - task = tasks.get('del') - if task: task.post([o.index_id() for o in obj_list]) def after_flush(self, obj=None): actions = [ - ((self.objects_added + self.objects_modified), self._add_to_index), - ((self.objects_deleted), self._del_from_index) + ((self.objects_added + self.objects_modified), 'add'), + ((self.objects_deleted), 'del') ] for obj_list, action in actions: if obj_list: types_objects_map = self._objects_by_types(obj_list) for class_path, obj_list in types_objects_map.iteritems(): tasks = self.TASKS.get(class_path, {}) - action(tasks, obj_list) - + self._index_action(tasks, obj_list, action) class ArtifactSessionExtension(ManagedSessionExtension):