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

Tres Seaver tseaver@zope.com
Thu, 18 Oct 2001 11:56:47 -0400


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

Modified Files:
	Topic.py 
Log Message:
 - Commit Seb's refactoring of 'getDefaultView'.

=== Products/CMFTopic/Topic.py 1.23 => 1.24 ===
         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: