Back to index

plone3  3.1.7
Namespaces | Functions | Variables
AdvancedQuery Namespace Reference

Namespaces

namespace  AdvancedQuery
namespace  eval
namespace  ranking
namespace  sorting
namespace  tests

Functions

def _makeAdvancedQuery
 ZCatalog extension.
def _evalAdvancedQuery

Variables

tuple _s = ClassSecurityInfo()
 Security.

Function Documentation

def AdvancedQuery._evalAdvancedQuery (   self,
  query,
  sortSpecs = () 
) [private]
evaluate *query* for 'CatalogTool' and sort results according to *sortSpec*.

Definition at line 61 of file __init__.py.

00061 
00062   def _evalAdvancedQuery(self,query,sortSpecs=()):
00063     '''evaluate *query* for 'CatalogTool' and sort results according to *sortSpec*.'''
00064     query = query._clone()
00065 
00066     # taken from 'CatalogTool.searchResults'
00067     user = _getAuthenticatedUser(self)
00068     query &= In('allowedRolesAndUsers',self._listAllowedRolesAndUsers(user))
00069     if not _checkPermission(AccessInactivePortalContent,self):
00070       now= self.ZopeTime()
00071       if 'ValidityRange' in self.Indexes.objectIds():
00072         query &= Eq('ValidityRange', now)
00073       else:
00074         query &= Le('effective',now)
00075         query &= Ge('expires',now)
00076     return _eval(self,query,sortSpecs)

Here is the call graph for this function:

def AdvancedQuery._makeAdvancedQuery (   self,
  catalogSearchSpec 
) [private]

ZCatalog extension.

advanced query corresponding to *catalogSearchSpec* (a dictionary).

Definition at line 31 of file __init__.py.

00031 
00032 def _makeAdvancedQuery(self,catalogSearchSpec):
00033   '''advanced query corresponding to *catalogSearchSpec* (a dictionary).'''
00034   q = And(); get = catalogSearchSpec.get
00035   for i in self.Indexes.objectIds():
00036     vi = get(i)
00037     if vi is None or vi == '': continue
00038     if not (isinstance(vi, dict) and vi.get('query') is not None
00039             or getattr(vi, 'query', None) is not None):
00040       usage = get(i+'_usage')
00041       if usage is not None:
00042         if not usage.startswith('range:'):
00043           raise ValueError, 'unsupported usage spec: %s' % usage
00044         vi = {'query' : vi, 'range' : usage[6:]}
00045     q.addSubquery(Generic(i,vi))
00046   return q

Here is the call graph for this function:


Variable Documentation

tuple AdvancedQuery._s = ClassSecurityInfo()

Security.

Definition at line 25 of file __init__.py.