Back to index

plone3  3.1.7
Public Member Functions | Static Public Member Functions | Public Attributes
PlonePAS.browser.search.PASSearchView Class Reference
Inheritance diagram for PlonePAS.browser.search.PASSearchView:
Inheritance graph
[legend]
Collaboration diagram for PlonePAS.browser.search.PASSearchView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def sort
def searchUsers
def searchUsersByRequest
def searchGroups
def searchGroupsByRequest
def getPhysicalPath

Static Public Member Functions

def extractCriteriaFromRequest
def merge

Public Attributes

 pas

Detailed Description

Definition at line 7 of file search.py.


Member Function Documentation

Definition at line 11 of file search.py.

00011 
00012     def extractCriteriaFromRequest(request):
00013         criteria=request.form.copy()
00014 
00015         for key in [ "form.submitted", "submit", 'b_start', 'b_size']:
00016             if key in criteria:
00017                 del criteria[key]
00018 
00019         for (key, value) in criteria.items():
00020             if not value:
00021                 del criteria[key]
00022 
00023         return criteria
00024 

Here is the caller graph for this function:

Definition at line 70 of file search.py.

00070 
00071     def getPhysicalPath(self):
00072         # We call various PAS methods which can be ZCached. The ZCache
00073         # infrastructure relies on getPhysicalPath on the context being
00074         # available, which this view does not have, it not being a
00075         # persistent object. So we fake things and return the physical path
00076         # for our context.
00077         return self.context.getPhysicalPath()
00078 

Here is the caller graph for this function:

def PlonePAS.browser.search.PASSearchView.merge (   results,
  key 
) [static]

Definition at line 26 of file search.py.

00026 
00027     def merge(results, key):
00028         output={}
00029         for entry in results:
00030             id=entry[key]
00031             if id not in output:
00032                 output[id]=entry.copy()
00033             else:
00034                 buf=entry.copy()
00035                 buf.update(output[id])
00036                 output[id]=buf
00037 
00038         return output.values()
00039 

Definition at line 60 of file search.py.

00060 
00061     def searchGroups(self, **criteria):
00062         self.pas=getToolByName(self.context, "acl_users")
00063         return self.pas.searchGroups(**criteria)
00064 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 65 of file search.py.

00065 
00066     def searchGroupsByRequest(self, request):
00067         criteria=self.extractCriteriaFromRequest(request)
00068         return self.searchGroups(**criteria)
00069 

Here is the call graph for this function:

def PlonePAS.browser.search.PASSearchView.searchUsers (   self,
  sort_by = None,
  criteria 
)

Definition at line 47 of file search.py.

00047 
00048     def searchUsers(self, sort_by=None, **criteria):
00049         self.pas=getToolByName(self.context, "acl_users")
00050         results=self.merge(self.pas.searchUsers(**criteria), "userid")
00051         if sort_by is not None:
00052             results=self.sort(results, sort_by)
00053         return results
00054 

Here is the caller graph for this function:

def PlonePAS.browser.search.PASSearchView.searchUsersByRequest (   self,
  request,
  sort_by = None 
)

Definition at line 55 of file search.py.

00055 
00056     def searchUsersByRequest(self, request, sort_by=None):
00057         criteria=self.extractCriteriaFromRequest(request)
00058         return self.searchUsers(sort_by=sort_by, **criteria)
00059 

Here is the call graph for this function:

def PlonePAS.browser.search.PASSearchView.sort (   self,
  results,
  key 
)

Definition at line 40 of file search.py.

00040 
00041     def sort(self, results, key):
00042         def key_func(a):
00043             return a.get(key, "").lower()
00044         results.sort(key=key_func)
00045         return results
00046 


Member Data Documentation

Definition at line 48 of file search.py.


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