|
a/Allura/allura/model/session.py |
|
b/Allura/allura/model/session.py |
|
... |
|
... |
30 |
|
30 |
|
31 |
def after_flush(self, obj=None):
|
31 |
def after_flush(self, obj=None):
|
32 |
"Update artifact references, and add/update this artifact to solr"
|
32 |
"Update artifact references, and add/update this artifact to solr"
|
33 |
import allura.tasks.index_tasks
|
33 |
import allura.tasks.index_tasks
|
34 |
if not getattr(self.session, 'disable_artifact_index', False):
|
34 |
if not getattr(self.session, 'disable_artifact_index', False):
|
35 |
from .stats import CPA
|
35 |
from pylons import g
|
36 |
from .index import ArtifactReference, Shortlink
|
36 |
from .index import ArtifactReference, Shortlink
|
37 |
from .session import main_orm_session
|
37 |
from .session import main_orm_session
|
38 |
# Ensure artifact references & shortlinks exist for new objects
|
38 |
# Ensure artifact references & shortlinks exist for new objects
|
39 |
arefs = [
|
39 |
arefs = [
|
40 |
ArtifactReference.from_artifact(obj)
|
40 |
ArtifactReference.from_artifact(obj)
|
|
... |
|
... |
48 |
allura.tasks.index_tasks.del_artifacts.post(
|
48 |
allura.tasks.index_tasks.del_artifacts.post(
|
49 |
[ obj.index_id() for obj in self.objects_deleted ])
|
49 |
[ obj.index_id() for obj in self.objects_deleted ])
|
50 |
if arefs:
|
50 |
if arefs:
|
51 |
allura.tasks.index_tasks.add_artifacts.post([ aref._id for aref in arefs ])
|
51 |
allura.tasks.index_tasks.add_artifacts.post([ aref._id for aref in arefs ])
|
52 |
for obj in self.objects_added:
|
52 |
for obj in self.objects_added:
|
53 |
CPA.post('create', obj)
|
53 |
g.zarkov_event('create', extra=obj.index_id())
|
54 |
for obj in self.objects_modified:
|
54 |
for obj in self.objects_modified:
|
55 |
CPA.post('modify', obj)
|
55 |
g.zarkov_event('modify', extra=obj.index_id())
|
56 |
for obj in self.objects_deleted:
|
56 |
for obj in self.objects_deleted:
|
57 |
CPA.post('delete', obj)
|
57 |
g.zarkov_event('delete', extra=obj.index_id())
|
58 |
self.objects_added = []
|
58 |
self.objects_added = []
|
59 |
self.objects_modified = []
|
59 |
self.objects_modified = []
|
60 |
self.objects_deleted = []
|
60 |
self.objects_deleted = []
|
61 |
|
61 |
|
62 |
main_doc_session = Session.by_name('main')
|
62 |
main_doc_session = Session.by_name('main')
|