Back to index

plone3  3.1.7
Functions | Variables
queryCatalog Namespace Reference

Functions

def quotestring
def quotequery
def quote_bad_chars
def ensureFriendlyTypes
def rootAtNavigationRoot

Variables

list results = []
 catalog = context.portal_catalog
tuple indexes = catalog.indexes()
dictionary query = {}
 show_query = show_all
dictionary second_pass = {}
 REQUEST = context.REQUEST
tuple v = REQUEST.get(k)
list key = k[:-6]
tuple qs = query.get(k)

Function Documentation

Definition at line 57 of file queryCatalog.py.

00057 
00058 def ensureFriendlyTypes(query):
00059     ploneUtils = getToolByName(context, 'plone_utils')
00060     portal_type = query.get('portal_type', [])
00061     if not same_type(portal_type, []):
00062         portal_type = [portal_type]
00063     Type = query.get('Type', [])
00064     if not same_type(Type, []):
00065         Type = [Type]
00066     typesList = portal_type + Type
00067     if not typesList:
00068         friendlyTypes = ploneUtils.getUserFriendlyTypes(typesList)
00069         query['portal_type'] = friendlyTypes

Here is the call graph for this function:

Definition at line 51 of file queryCatalog.py.

00051 
00052 def quote_bad_chars(s):
00053     bad_chars = ["(", ")"]
00054     for char in bad_chars:
00055         s = s.replace(char, quotestring(char))
00056     return s

Here is the call graph for this function:

Definition at line 28 of file queryCatalog.py.

00028 
00029 def quotequery(s):
00030     if not s:
00031         return s
00032     try:
00033         terms = s.split()
00034     except ConflictError:
00035         raise
00036     except:
00037         return s
00038     tokens = ('OR', 'AND', 'NOT')
00039     s_tokens = ('OR', 'AND')
00040     check = (0, -1)
00041     for idx in check:
00042         if terms[idx].upper() in tokens:
00043             terms[idx] = quotestring(terms[idx])
00044     for idx in range(1, len(terms)):
00045         if (terms[idx].upper() in s_tokens and
00046             terms[idx-1].upper() in tokens):
00047             terms[idx] = quotestring(terms[idx])
00048     return ' '.join(terms)
00049 
00050 # We need to quote parentheses when searching text indices (we use
# quote_logic_indexes as the list of text indices)

Here is the call graph for this function:

Definition at line 25 of file queryCatalog.py.

00025 
00026 def quotestring(s):
00027     return '"%s"' % s

Here is the caller graph for this function:

Definition at line 70 of file queryCatalog.py.

00070 
00071 def rootAtNavigationRoot(query):
00072     if 'path' not in query:
00073         query['path'] = getNavigationRoot(context)
00074 
# Avoid creating a session implicitly.

Here is the call graph for this function:


Variable Documentation

queryCatalog.catalog = context.portal_catalog

Definition at line 16 of file queryCatalog.py.

tuple queryCatalog.indexes = catalog.indexes()

Definition at line 17 of file queryCatalog.py.

list queryCatalog.key = k[:-6]

Definition at line 87 of file queryCatalog.py.

tuple queryCatalog.qs = query.get(k)

Definition at line 97 of file queryCatalog.py.

dictionary queryCatalog.query = {}

Definition at line 18 of file queryCatalog.py.

queryCatalog.REQUEST = context.REQUEST

Definition at line 23 of file queryCatalog.py.

Definition at line 15 of file queryCatalog.py.

dictionary queryCatalog.second_pass = {}

Definition at line 20 of file queryCatalog.py.

int queryCatalog.show_query = show_all

Definition at line 19 of file queryCatalog.py.

tuple queryCatalog.v = REQUEST.get(k)

Definition at line 78 of file queryCatalog.py.