查詢目錄內容項目清單的方法有好幾種,但 objectValues() 和 contentValues() 則是最耗資源的兩種,應優先考慮改用 catalog 工具,範例如下:
catalog = getToolByName(self, 'portal_catalog')更多資訊可參考 http://plone.org/documentation/tutorial/richdocument/folder-listings
results = catalog.searchResults(
path = {'query' : '/'.join(self.getPhysicalPath()),
'depth' : 1 },
sort_on = 'getObjPositionInParent',
)
No comments:
Post a Comment