-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeywordVocabulary override is not plone.volto specific #157
Comments
I don't know why there are two different vocabularies. But |
Yes, right,
I have compared Plone 6.0.11 buildout's return None
if registry.get("plone.subjects_of_navigation_root", False):
portal = getToolByName(context, "portal_url").getPortalObject()
- return get_navigation_root_object(context, portal)
+ return getNavigationRootObject(context, portal)
return None
def all_keywords(self, kwfilter):
...
result = []
# query all oids of path - low level
pquery = {
- self.path_index: {
- "query": "/".join(section.getPhysicalPath()),
- "depth": -1,
- }
+ self.path_index: {"query": "/".join(section.getPhysicalPath()), "depth": -1}
}
- kwfilter = safe_text(kwfilter)
+ kwfilter = safe_encode(kwfilter)
# uses internal zcatalog specific details to quickly get the values.
path_result, info = path_idx._apply_index(pquery)
for tag in tags_idx.uniqueValues():
- if kwfilter and kwfilter not in safe_text(tag):
+ if kwfilter and kwfilter not in safe_encode(tag):
continue
tquery = {self.keyword_index: tag}
tags_result, info = tags_idx._apply_index(tquery) The diff is the same for latest versions The override doc string states that the reason for the override is to "Override Keywords vocabulary to provide the real Keyword as the token.", but I also compared the original override committed on Jan 29, 2020 with # Allow users to customize the index to easily create
# KeywordVocabularies for other keyword indexes
- keyword_index = 'Subject'
- path_index = 'path'
+ keyword_index = "Subject"
+ path_index = "path"
def section(self, context):
"""gets section from which subjects are used.
...
registry = queryUtility(IRegistry)
if registry is None:
return None
- if registry.get('plone.subjects_of_navigation_root', False):
- portal = getToolByName(context, 'portal_url').getPortalObject()
+ if registry.get("plone.subjects_of_navigation_root", False):
+ portal = getToolByName(context, "portal_url").getPortalObject()
return getNavigationRootObject(context, portal)
return None
def all_keywords(self, kwfilter):
site = getSite()
- self.catalog = getToolByName(site, 'portal_catalog', None)
+ self.catalog = getToolByName(site, "portal_catalog", None)
if self.catalog is None:
return SimpleVocabulary([])
index = self.catalog._catalog.getIndex(self.keyword_index)
...
def keywords_of_section(self, section, kwfilter):
"""Valid keywords under the given section.
"""
- pcat = getToolByName(section, 'portal_catalog')
+ pcat = getToolByName(section, "portal_catalog")
cat = pcat._catalog
path_idx = cat.indexes[self.path_index]
tags_idx = cat.indexes[self.keyword_index]
result = []
# query all oids of path - low level
pquery = {
- self.path_index: {
- 'query': '/'.join(section.getPhysicalPath()),
- 'depth': -1,
- }
+ self.path_index: {"query": "/".join(section.getPhysicalPath()), "depth": -1}
}
kwfilter = safe_encode(kwfilter)
# uses internal zcatalog specific details to quickly get the values. Seems like, the actual point is to patch how the terms are generated The original issue plone/plone.restapi#782 states: "This seems to work in the legacy plone interface too". This is probably true, since As far as I see there is no point overriding the vocabulary. It should either patch the |
The KeywordsVocabulary is always replaced by the volto version, even if
plone.volto
is not installed for the Plone site and it runs on classic UI.plone.volto/src/plone/volto/overrides.zcml
Lines 6 to 9 in fdb8923
The override has been introduced with commit 1b96c31
It should be using
zcml:condition="installed plone.volto"
.The text was updated successfully, but these errors were encountered: