[CMF-checkins] CVS: CMF/CMFCore - TypesTool.py:1.60

Yvo Schubbe schubbe@web.de
Thu, 31 Jul 2003 11:47:53 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv19086/CMFCore

Modified Files:
	TypesTool.py 
Log Message:
Fixed bug in _guessMethodAliases:
Don't complain if we can't simulate _getViewFor behavior. There are CMF 1.4 content types that don't depend on _getViewFor.

=== CMF/CMFCore/TypesTool.py 1.59 => 1.60 ===
--- CMF/CMFCore/TypesTool.py:1.59	Tue Jul 15 11:50:38 2003
+++ CMF/CMFCore/TypesTool.py	Thu Jul 31 11:47:18 2003
@@ -392,13 +392,17 @@
         actions = self.listActions()
         ordered = []
         _dict = {}
+        viewmethod = ''
 
         # order actions and search 'mkdir' action 
         for action in actions:
             if action.getId() == 'view':
                 ordered.insert(0, action)
             elif action.getId() == 'mkdir':
-                mkdirmethod = action.action(context).strip()
+                try:
+                    mkdirmethod = action.action(context).strip()
+                except AttributeError:
+                    continue
                 if mkdirmethod.startswith('/'):
                     mkdirmethod = mkdirmethod[1:]
                 _dict['mkdir'] = mkdirmethod
@@ -409,7 +413,10 @@
         for action in ordered:
             perms = action.getPermissions()
             if not perms or View in perms:
-                viewmethod = action.action(context).strip()
+                try:
+                    viewmethod = action.action(context).strip()
+                except AttributeError:
+                    break
                 if viewmethod.startswith('/'):
                     viewmethod = viewmethod[1:]
                 if not viewmethod:
@@ -417,17 +424,22 @@
                 break
         else:
             viewmethod = '(Default)'
-        _dict['view'] = viewmethod
+        if viewmethod:
+            _dict['view'] = viewmethod
 
         # search default action
         for action in ordered:
-            defmethod = action.action(context).strip()
+            try:
+                defmethod = action.action(context).strip()
+            except AttributeError:
+                break
             if defmethod.startswith('/'):
                 defmethod = defmethod[1:]
             if not defmethod:
                 break
         else:
-            _dict['(Default)'] = viewmethod
+            if viewmethod:
+                _dict['(Default)'] = viewmethod
 
         # correct guessed values if we know better
         if self.content_meta_type in ('Portal File', 'Portal Folder',