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 A145E1104C for ; Fri, 19 Sep 2014 20:04:16 +0000 (UTC) Received: (qmail 58452 invoked by uid 500); 19 Sep 2014 20:04:16 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 58421 invoked by uid 500); 19 Sep 2014 20:04:16 -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 58329 invoked by uid 99); 19 Sep 2014 20:04:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Sep 2014 20:04:16 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F4197A1FF36; Fri, 19 Sep 2014 20:04:15 +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: Fri, 19 Sep 2014 20:04:18 -0000 Message-Id: <097334f5336941eebf73083f14719487@git.apache.org> In-Reply-To: <329e5833b1f74c828e7af57fa26c2b12@git.apache.org> References: <329e5833b1f74c828e7af57fa26c2b12@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/26] git commit: [#7589] ticket:622 Tasks for indexing users [#7589] ticket:622 Tasks for indexing users Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/5bec5b7c Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5bec5b7c Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5bec5b7c Branch: refs/heads/master Commit: 5bec5b7c16ef4a90f274a4ad4bd95895e77ab6b6 Parents: 55be310 Author: Igor Bondarenko Authored: Mon Aug 4 14:50:18 2014 +0300 Committer: Dave Brondsema Committed: Fri Sep 19 19:35:38 2014 +0000 ---------------------------------------------------------------------- Allura/allura/model/session.py | 4 +++- Allura/allura/tasks/index_tasks.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/5bec5b7c/Allura/allura/model/session.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/session.py b/Allura/allura/model/session.py index 8e0f551..eb1f4ba 100644 --- a/Allura/allura/model/session.py +++ b/Allura/allura/model/session.py @@ -68,7 +68,9 @@ class IndexerSessionExtension(ManagedSessionExtension): TASKS = { 'allura.model.project.Project': {'add': index_tasks.add_projects, - 'del': index_tasks.del_projects} + 'del': index_tasks.del_projects}, + 'allura.model.auth.User': {'add': index_tasks.add_users, + 'del': index_tasks.del_users}, } def _objects_by_types(self, obj_list): http://git-wip-us.apache.org/repos/asf/allura/blob/5bec5b7c/Allura/allura/tasks/index_tasks.py ---------------------------------------------------------------------- diff --git a/Allura/allura/tasks/index_tasks.py b/Allura/allura/tasks/index_tasks.py index 3f02cef..c9e853d 100644 --- a/Allura/allura/tasks/index_tasks.py +++ b/Allura/allura/tasks/index_tasks.py @@ -57,6 +57,18 @@ def del_projects(project_solr_ids): @task +def add_users(user_ids): + from allura.model import User + users = User.query.find(dict(_id={'$in': user_ids})).all() + __add_objects(users) + + +@task +def del_users(user_solr_ids): + __del_objects(user_solr_ids) + + +@task def add_artifacts(ref_ids, update_solr=True, update_refs=True, solr_hosts=None): ''' Add the referenced artifacts to SOLR and shortlinks.