|
2 | 2 | from plone.app.blocks.layoutbehavior import ILayoutAware |
3 | 3 | from plone.app.blocks.layoutbehavior import ILayoutBehaviorAdaptable |
4 | 4 | from plone.app.contenttypes import indexers |
| 5 | +from plone.app.dexterity.textindexer.interfaces import IDynamicTextIndexExtender |
5 | 6 | from plone.base.utils import safe_text |
6 | | -from plone.indexer.decorator import indexer |
7 | 7 | from plone.tiles.data import ANNOTATIONS_KEY_PREFIX |
8 | 8 | from zope.annotation.interfaces import IAnnotations |
9 | 9 | from zope.component import adapter |
10 | 10 | from zope.interface import implementer |
11 | 11 |
|
12 | | - |
13 | | -HAS_DEXTERITYTEXTINDEXER = False |
14 | | - |
15 | | -try: |
16 | | - from collective.dexteritytextindexer.interfaces import ( # noqa |
17 | | - IDynamicTextIndexExtender, |
18 | | - ) |
19 | | - |
20 | | - HAS_DEXTERITYTEXTINDEXER = True |
21 | | -except ImportError: |
22 | | - pass |
23 | | - |
24 | | -try: |
25 | | - from plone.app.dexterity.textindexer.interfaces import ( # noqa |
26 | | - IDynamicTextIndexExtender, |
27 | | - ) |
28 | | - |
29 | | - HAS_DEXTERITYTEXTINDEXER = True |
30 | | -except ImportError: |
31 | | - pass |
32 | | - |
33 | 12 | concat = indexers._unicode_save_string_concat |
34 | 13 |
|
35 | 14 |
|
36 | | -@indexer(ILayoutBehaviorAdaptable) |
37 | 15 | def LayoutSearchableText(obj): |
38 | 16 | text = [obj.id] |
39 | 17 | try: |
@@ -77,13 +55,11 @@ def LayoutSearchableText(obj): |
77 | 55 | return concat(*set(text)) |
78 | 56 |
|
79 | 57 |
|
80 | | -if HAS_DEXTERITYTEXTINDEXER: |
81 | | - |
82 | | - @implementer(IDynamicTextIndexExtender) |
83 | | - @adapter(ILayoutBehaviorAdaptable) |
84 | | - class LayoutSearchableTextIndexExtender: |
85 | | - def __init__(self, context): |
86 | | - self.context = context |
| 58 | +@implementer(IDynamicTextIndexExtender) |
| 59 | +@adapter(ILayoutBehaviorAdaptable) |
| 60 | +class LayoutSearchableTextIndexExtender: |
| 61 | + def __init__(self, context): |
| 62 | + self.context = context |
87 | 63 |
|
88 | | - def __call__(self): |
89 | | - return LayoutSearchableText(self.context)() |
| 64 | + def __call__(self): |
| 65 | + return LayoutSearchableText(self.context) |
0 commit comments