Commit d91a31e2 authored by Jérome Perrin's avatar Jérome Perrin

getDocumentTemplateList can also be called directly on the preference tool,...

getDocumentTemplateList can also be called directly on the preference tool, then the method signature must be compatible.

fix typo on getPortalType.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5239 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 63afa73a
...@@ -184,17 +184,21 @@ class PreferenceTool(BaseTool): ...@@ -184,17 +184,21 @@ class PreferenceTool(BaseTool):
return enabled_prefs[0] return enabled_prefs[0]
security.declareProtected(Permissions.View, 'getDocumentTemplateList') security.declareProtected(Permissions.View, 'getDocumentTemplateList')
def getDocumentTemplateList(self, folder) : def getDocumentTemplateList(self, folder=None) :
""" returns all document templates that are in acceptable Preferences """ returns all document templates that are in acceptable Preferences
based on different criteria such as folder, portal_type, etc. based on different criteria such as folder, portal_type, etc.
XXX This spec still needs to be refined before implementation
""" """
if folder is None :
# as the preference tool is also a Folder, this method is called by
# page templates to get the list of document templates for self.
folder =self
acceptable_templates = [] acceptable_templates = []
allowed_content_types = map(lambda pti: pti.id, folder.allowedContentTypes()) allowed_content_types = map(lambda pti: pti.id,
folder.allowedContentTypes())
for pref in self._getSortedPreferenceList() : for pref in self._getSortedPreferenceList() :
for doc in pref.objectValues() : for doc in pref.objectValues() :
if doc.getPortalTypes() in allowed_content_types: if doc.getPortalType() in allowed_content_types:
acceptable_templates.append (doc) acceptable_templates.append (doc)
return acceptable_templates return acceptable_templates
......
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