allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [04/26] git commit: [#7589] ticket:622 Tasks for indexing users
Date Fri, 19 Sep 2014 20:04:18 GMT
[#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 <jetmind2@gmail.com>
Authored: Mon Aug 4 14:50:18 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
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.


Mime
View raw message