[CMF-checkins] CVS: CMF/CMFTopic - Topic.py:1.23.2.1

seb seb@jamkit.com
Thu, 18 Oct 2001 05:52:29 -0400


Update of /cvs-repository/CMF/CMFTopic
In directory cvs.zope.org:/tmp/cvs-serv9412/Products/CMFTopic

Modified Files:
      Tag: seb-defaultActionRefactor-branch
	Topic.py 
Log Message:
Refactored getDefaultView into CMFCore.utils._getView; can now specify a view to get by name.  
Added new TypesTool unit test.


=== CMF/CMFTopic/Topic.py 1.23 => 1.23.2.1 ===
         return 0
 
-    def _getDefaultView(self):
-        ti = self.getTypeInfo()
-        if ti is not None:
-            actions = ti.getActions()
-            for action in actions:
-                if action.get('id', None) == 'view':
-                    if self._verifyActionPermissions(action):
-                        return self.restrictedTraverse(action['action'])
-            # "view" action is not present or not allowed.
-            # Find something that's allowed.
-            for action in actions:
-                if self._verifyActionPermissions(action):
-                    return self.restrictedTraverse(action['action'])
-            raise 'Unauthorized', ('No accessible views available for %s' %
-                                 string.join(self.getPhysicalPath(), '/'))
-        else:
-            raise 'Not Found', ('Cannot find default view for "%s"' %
-                                string.join(self.getPhysicalPath(), '/'))
-
     def __call__(self):
         '''
         Invokes the default view.
         '''
-        view = self._getDefaultView()
+        view = utils._getViewFor(self)
         if getattr(aq_base(view), 'isDocTemp', 0):
             return apply(view, (self, self.REQUEST))
         else: