[CMF-checkins] CVS: CMF/CMFCore - PortalFolder.py:1.46.8.2

Yvo Schubbe schubbe@web.de
Sat, 28 Jun 2003 10:30:24 -0400


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

Modified Files:
      Tag: yuppie-ti_aliases-branch
	PortalFolder.py 
Log Message:
- made PortalFolder's 'mkdir' hook an alias

=== CMF/CMFCore/PortalFolder.py 1.46.8.1 => 1.46.8.2 ===
--- CMF/CMFCore/PortalFolder.py:1.46.8.1	Sun Jun 22 12:17:43 2003
+++ CMF/CMFCore/PortalFolder.py	Sat Jun 28 10:29:54 2003
@@ -41,6 +41,9 @@
   , 'factory'        : 'manage_addPortalFolder'
   , 'filter_content_types' : 0
   , 'immediate_view' : 'folder_edit_form'
+  , 'aliases'        : {'(Default)':'index_html',
+                        'view':'index_html',
+                        'index.html':'index_html'}
   , 'actions'        : ( { 'id'            : 'view'
                          , 'name'          : 'View'
                          , 'action': 'string:${object_url}'
@@ -49,7 +52,7 @@
                          }
                        , { 'id'            : 'edit'
                          , 'name'          : 'Edit'
-                         , 'action': 'string:${object_url}/edit'
+                         , 'action': 'string:${object_url}/folder_edit_form'
                          , 'permissions'   : (ManageProperties,)
                          , 'category'      : 'folder'
                          }
@@ -61,10 +64,6 @@
                          , 'category'      : 'folder'
                          }
                        )
-  , 'aliases'        : {'(Default)':'index_html',
-                        'view':'index_html',
-                        'index.html':'index_html',
-                        'edit':'folder_edit_form'}
   }
 ,
 )
@@ -468,20 +467,18 @@
                         , title=''
                         , REQUEST=None
                         ):
+        """ Add a new folder-like object with id *id*.
+
+        IF present, use the parent object's 'mkdir' alias; otherwise, just add
+        a PortalFolder.
         """
-            Add a new folder-like object with id *id*.  IF present,
-            use the parent object's 'mkdir' action;  otherwise, just
-            add a PortalFolder.
-            to take control of the process by checking for a 'mkdir'
-            action.
-        """
-        try:
-            action = self.getTypeInfo().getActionById( 'mkdir' )
-        except ValueError:
-            self.invokeFactory( type_name='Folder', id=id )
-        else:
+        ti = self.getTypeInfo()
+        method = ti and ti.getMethodURL('mkdir') or None
+        if method:
             # call it
-            getattr( self, action )( id=id )
+            getattr(self, method)(id=id)
+        else:
+            self.invokeFactory( type_name='Folder', id=id )
 
         ob = self._getOb( id )
         ob.setTitle( title )