Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.app.vocabularies.catalog.SearchableTextSourceBinder Class Reference

List of all members.

Public Member Functions

def __init__
def __call__

Public Attributes

 query
 default_query

Detailed Description

Use this to instantiate a new SearchableTextSource with custom
parameters. For example:

target_folder = schema.Choice(
    title=_(u"Target folder"),
    description=_(u"As a path relative to the portal root"),
    required=True,
    source=SearchableTextSourceBinder({'is_folderish' : True}),
    )

This ensures that the is_folderish=True is always in the query used.

  >>> query = {'query': 'query'}

  >>> binder = SearchableTextSourceBinder(query)
  >>> binder
  <plone.app.vocabularies.catalog.SearchableTextSourceBinder object at ...>

  >>> binder.query == query
  True

  >>> from plone.app.vocabularies.tests.base import Brain
  >>> from plone.app.vocabularies.tests.base import DummyContext
  >>> from plone.app.vocabularies.tests.base import DummyTool

  >>> context = DummyContext()

  >>> tool = DummyTool('portal_catalog')
  >>> context.portal_catalog = tool

  >>> tool = DummyTool('portal_url')
  >>> def getPortalPath():
  ...     return '/'
  >>> tool.getPortalPath = getPortalPath
  >>> context.portal_url = tool

  >>> source = binder(context)
  >>> source
  <plone.app.vocabularies.catalog.SearchableTextSource object at ...>

  >>> source.base_query == query
  True

Definition at line 175 of file catalog.py.


Constructor & Destructor Documentation

def plone.app.vocabularies.catalog.SearchableTextSourceBinder.__init__ (   self,
  query,
  default_query = None 
)

Definition at line 222 of file catalog.py.

00222 
00223     def __init__(self, query, default_query=None):
00224         self.query = query
00225         self.default_query = default_query
        

Here is the caller graph for this function:


Member Function Documentation

Definition at line 226 of file catalog.py.

00226 
00227     def __call__(self, context):
00228         return SearchableTextSource(context, base_query=self.query.copy(),
00229                                     default_query=self.default_query)
00230     

Here is the caller graph for this function:


Member Data Documentation

Definition at line 224 of file catalog.py.

Definition at line 223 of file catalog.py.


The documentation for this class was generated from the following file: