equal
deleted
inserted
replaced
17 |
17 |
18 # import interfaces |
18 # import interfaces |
19 from pyams_thesaurus.interfaces.thesaurus import IThesaurusContextManager, IThesaurusContextManagerTarget |
19 from pyams_thesaurus.interfaces.thesaurus import IThesaurusContextManager, IThesaurusContextManagerTarget |
20 |
20 |
21 # import packages |
21 # import packages |
|
22 from pyams_sequence.schema import InternalReferenceField |
22 from pyams_thesaurus.schema import ThesaurusTermsListField |
23 from pyams_thesaurus.schema import ThesaurusTermsListField |
23 from zope.interface import Interface |
24 from zope.interface import Interface, invariant, Invalid |
|
25 from zope.schema import Bool |
24 |
26 |
25 from pyams_content import _ |
27 from pyams_content import _ |
26 |
28 |
27 |
29 |
28 # |
30 # |
33 TAGS_INFO_KEY = 'pyams_content.tags.info' |
35 TAGS_INFO_KEY = 'pyams_content.tags.info' |
34 |
36 |
35 |
37 |
36 class ITagsManager(IThesaurusContextManager): |
38 class ITagsManager(IThesaurusContextManager): |
37 """Tags manager interface""" |
39 """Tags manager interface""" |
|
40 |
|
41 enable_tags_search = Bool(title=_("Enable search by tag?"), |
|
42 description=_("If 'yes', displayed tags will lead to a search engine " |
|
43 "displaying contents matching given tag"), |
|
44 required=True, |
|
45 default=False) |
|
46 |
|
47 tags_search_target = InternalReferenceField(title=_("Tags search target"), |
|
48 description=_("Site or folder where tags search is displayed"), |
|
49 required=False) |
|
50 |
|
51 @invariant |
|
52 def check_search_target(self): |
|
53 if self.enable_tags_search and not self.tags_search_target: |
|
54 raise Invalid(_("You must specify search target when activating search by tags!")) |
38 |
55 |
39 |
56 |
40 class ITagsManagerTarget(IThesaurusContextManagerTarget): |
57 class ITagsManagerTarget(IThesaurusContextManagerTarget): |
41 """Marker interface for tags manager""" |
58 """Marker interface for tags manager""" |
42 |
59 |