|
a/Allura/allura/model/session.py |
|
b/Allura/allura/model/session.py |
|
... |
|
... |
34 |
if not getattr(self.session, 'disable_artifact_index', False):
|
34 |
if not getattr(self.session, 'disable_artifact_index', False):
|
35 |
from pylons import g
|
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 |
try:
|
40 |
try:
|
40 |
arefs = [
|
41 |
arefs = [
|
41 |
ArtifactReference.from_artifact(obj)
|
42 |
ArtifactReference.from_artifact(obj)
|
42 |
for obj in self.objects_added + self.objects_modified ]
|
43 |
for obj in self.objects_added + self.objects_modified ]
|
43 |
for obj in self.objects_added + self.objects_modified:
|
44 |
for obj in self.objects_added + self.objects_modified:
|
44 |
Shortlink.from_artifact(obj)
|
45 |
Shortlink.from_artifact(obj)
|
45 |
# Flush shortlinks
|
46 |
# Flush shortlinks
|
46 |
main_orm_session.flush()
|
47 |
main_orm_session.flush()
|
47 |
except Exception:
|
48 |
except Exception:
|
48 |
log.error("Failed to update artifact references. Is this a borked project migration?")
|
49 |
log.exception("Failed to update artifact references. Is this a borked project migration?")
|
49 |
# Post delete and add indexing operations
|
50 |
# Post delete and add indexing operations
|
50 |
if self.objects_deleted:
|
51 |
if self.objects_deleted:
|
51 |
allura.tasks.index_tasks.del_artifacts.post(
|
52 |
allura.tasks.index_tasks.del_artifacts.post(
|
52 |
[ obj.index_id() for obj in self.objects_deleted ])
|
53 |
[ obj.index_id() for obj in self.objects_deleted ])
|
53 |
if arefs:
|
54 |
if arefs:
|