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

Tres Seaver tseaver@zope.com
Mon, 13 Aug 2001 17:44:18 -0400


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv7273/CMFCore

Modified Files:
	TypesTool.py 
Log Message:


 - Make tool, rather than type objects, responsible for generating
   "immediate view" URL;  type objects now return the newly-created
   object, which makes scripting them much simpler.


=== Products/CMFCore/TypesTool.py 1.18 => 1.19 ===
         if hasattr(ob, '_setPortalTypeName'):
             ob._setPortalTypeName(self.getId())
-        return '%s/%s' % ( ob.absolute_url(), self.immediate_view )
+        return ob
 
 InitializeClass( FactoryTypeInformation )
 
@@ -544,7 +544,7 @@
         if hasattr(ob, '_setPortalTypeName'):
             ob._setPortalTypeName(self.getId())
 
-        return '%s/%s' % ( ob.absolute_url(), self.immediate_view )
+        return ob
 
 InitializeClass( ScriptableTypeInformation )
 
@@ -753,10 +753,11 @@
         if info is None:
             raise 'ValueError', 'No such content type: %s' % type_name
         
-        immediate_url = apply(info.constructInstance,
-                            (container, id) + args, kw)
+        ob = apply(info.constructInstance, (container, id) + args, kw)
 
         if RESPONSE is not None:
+            immediate_url = '%s/%s' % ( ob.absolute_url()
+                                      , info.immediate_view )
             RESPONSE.redirect( immediate_url )
 
 InitializeClass( TypesTool )