From d91a31e283c070b7f622fd3475880f4e5b336dd1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Sat, 21 Jan 2006 22:18:21 +0000
Subject: [PATCH] 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
---
 product/ERP5Form/PreferenceTool.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/product/ERP5Form/PreferenceTool.py b/product/ERP5Form/PreferenceTool.py
index d48ee54052..eab2fdc575 100755
--- a/product/ERP5Form/PreferenceTool.py
+++ b/product/ERP5Form/PreferenceTool.py
@@ -184,17 +184,21 @@ class PreferenceTool(BaseTool):
       return enabled_prefs[0]
 
   security.declareProtected(Permissions.View, 'getDocumentTemplateList')
-  def getDocumentTemplateList(self, folder) :
+  def getDocumentTemplateList(self, folder=None) :
     """ returns all document templates that are in acceptable Preferences 
         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 = []
-    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 doc in pref.objectValues() :
-        if doc.getPortalTypes() in allowed_content_types:
+        if doc.getPortalType() in allowed_content_types:
           acceptable_templates.append (doc)
     return acceptable_templates
 
-- 
2.30.9