本文整理匯總了Python中Products.TinyMCE.adapters.interfaces.JSONSearch.IJSONSearch類的典型用法代碼示例。如果您正苦於以下問題:Python IJSONSearch類的具體用法?Python IJSONSearch怎麽用?Python IJSONSearch使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了IJSONSearch類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: jsonLinkableSearch
def jsonLinkableSearch(self, searchtext):
"""Returns the search results of linkable objects in JSON"""
utility = getToolByName(aq_inner(self.context), 'portal_tinymce')
linkable_portal_types = utility.linkable.split('\n')
linkable_portal_types.extend(utility.containsobjects.split('\n'))
object = IJSONSearch(self.context, None)
if object is None:
return ''
results = object.getSearchResults(linkable_portal_types, searchtext)
return results
示例2: jsonSCEmbedderSearch
def jsonSCEmbedderSearch(self, searchtext):
"""Returns the search results of sc.embedder objects in JSON"""
utility = getUtility(ITinyMCE)
portal_types = ["sc.embedder"]
portal_types.extend(utility.containsobjects.split("\n"))
object = IJSONSearch(self.context, None)
if object is None:
return ""
results = object.getSearchResults(portal_types, searchtext)
return results
示例3: jsonImageSearch
def jsonImageSearch(self, searchtext):
"""Returns the search results of image objects in JSON"""
utility = getUtility(ITinyMCE)
image_portal_types = utility.imageobjects.split('\n')
image_portal_types.extend(utility.containsobjects.split('\n'))
object = IJSONSearch(self.context, None)
if object is None:
return ''
results = object.getSearchResults(image_portal_types, searchtext)
return results
示例4: jsonImageSearch
def jsonImageSearch(self, searchtext):
"""Returns the search results of image objects in JSON"""
utility = getToolByName(aq_inner(self.context), "portal_tinymce")
image_portal_types = utility.imageobjects.split("\n")
image_portal_types.extend(utility.containsobjects.split("\n"))
object = IJSONSearch(self.context, None)
if object is None:
return ""
results = object.getSearchResults(image_portal_types, searchtext)
return results
示例5: test_json_search
def test_json_search(self):
# Create an Event
self.portal.invokeFactory('Event', id='events', title='Events')
# The json search is used the look for content types within the self.portal. Let's see
# if we can find some items containing the searchterm 'Events'
linkable_portal_types = self.utility.linkable.split('\n')
linkable_portal_types.extend(self.utility.containsobjects.split('\n'))
obj = IJSONSearch(self.portal)
self.assertRegexpMatches(
obj.getSearchResults(filter_portal_types=linkable_portal_types,
searchtext='Events',
), '\{.*"title": "Events", "url": "http://nohost/plone/events".*}')