|
a/Allura/allura/tasks/index_tasks.py |
|
b/Allura/allura/tasks/index_tasks.py |
1 |
import sys
|
1 |
import sys
|
2 |
import logging
|
2 |
import logging
|
3 |
from contextlib import contextmanager
|
3 |
from contextlib import contextmanager
|
4 |
|
4 |
|
5 |
from pylons import g, c
|
5 |
from pylons import g
|
6 |
|
6 |
|
7 |
from allura.lib.decorators import task
|
7 |
from allura.lib.decorators import task
|
8 |
from allura.lib.exceptions import CompoundError
|
8 |
from allura.lib.exceptions import CompoundError
|
9 |
|
9 |
|
10 |
log = logging.getLogger(__name__)
|
10 |
log = logging.getLogger(__name__)
|
|
... |
|
... |
19 |
for ref_id in ref_ids:
|
19 |
for ref_id in ref_ids:
|
20 |
try:
|
20 |
try:
|
21 |
ref = M.ArtifactReference.query.get(_id=ref_id)
|
21 |
ref = M.ArtifactReference.query.get(_id=ref_id)
|
22 |
artifact = ref.artifact
|
22 |
artifact = ref.artifact
|
23 |
s = solarize(artifact)
|
23 |
s = solarize(artifact)
|
24 |
if s is not None:
|
24 |
if s is None: continue
|
25 |
g.solr.add([s])
|
25 |
g.solr.add([s])
|
26 |
if not isinstance(artifact, M.Snapshot):
|
26 |
if isinstance(artifact, M.Snapshot): continue
|
27 |
ref.references = [
|
27 |
ref.references = [
|
28 |
link.ref_id for link in find_shortlinks(s['text']) ]
|
28 |
link.ref_id for link in find_shortlinks(s['text']) ]
|
29 |
except Exception:
|
29 |
except Exception:
|
30 |
exceptions.append(sys.exc_info())
|
30 |
exceptions.append(sys.exc_info())
|
31 |
if exceptions:
|
31 |
if exceptions:
|
32 |
raise CompoundError(*exceptions)
|
32 |
raise CompoundError(*exceptions)
|
33 |
|
33 |
|