Skip to content

Commit

Permalink
Revert "Remove moribund code."
Browse files Browse the repository at this point in the history
This reverts commit 8e71006.
  • Loading branch information
alecpm authored and pbauer committed Aug 11, 2021
1 parent 092635e commit b13d32f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions plone/app/vocabularies/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
from zope.component.hooks import getSite

try:
from zope.globalrequest import getRequest
except ImportError:
def getRequest():
return None

import itertools
import os
import six
Expand Down Expand Up @@ -659,6 +666,12 @@ def __call__(self, context, query=None):
return CatalogVocabulary.fromItems(parsed, context)


def request_query_cache_key(func, vocab):
return json.dumps([
vocab.query, vocab.text_search_index, vocab.title_template
])


@implementer(IQuerySource, IVocabularyFactory)
class StaticCatalogVocabulary(CatalogVocabulary):
"""Catalog Vocabulary for static queries of content based on a fixed query.
Expand Down Expand Up @@ -804,6 +817,10 @@ def get_brain_path(self, brain):
path = path[len(nav_root_path):]
return path

@staticmethod
def get_request():
return getRequest()

@property
@view_memoize
def brains(self):
Expand Down

0 comments on commit b13d32f

Please sign in to comment.