Commit 3dc2ad5b authored by Yoshinori Okuji's avatar Yoshinori Okuji

Use searchResults rather than z_search_results from searchFolder.

Add countFolder.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2869 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e62ae43b
......@@ -171,7 +171,27 @@ class ERP5Site ( CMFSite, FolderMixIn ):
kw2[cname] = kw[cname]
# The method to call to search the folder
# content has to be called z_search_folder
method = self.portal_catalog.z_search_folder
method = self.portal_catalog.searchResults
return method(**kw2)
security.declareProtected(Permissions.AccessContentsInformation, 'countFolder')
def countFolder(self, **kw):
"""
Count the content of a folder by calling
the portal_catalog.
"""
if not kw.has_key('parent_uid'):
kw['parent_uid'] = self.uid
kw2 = {}
# Remove useless matter before calling the
# catalog. In particular, consider empty
# strings as None values
for cname in kw.keys():
if kw[cname] != '' and kw[cname]!=None:
kw2[cname] = kw[cname]
# The method to call to search the folder
# content has to be called z_search_folder
method = self.portal_catalog.countResults
return method(**kw2)
# Proxy methods for security reasons
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment