[CMF-checkins] CVS: CMF/CMFCore - TypesTool.py:1.26
Tres Seaver
tseaver@zope.com
Thu, 29 Nov 2001 22:35:39 -0500
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv8913/CMFCore
Modified Files:
TypesTool.py
Log Message:
- Use the ID returned from the factory, if any, in 'FTI.constructInstance'
(tracker #357).
=== CMF/CMFCore/TypesTool.py 1.25 => 1.26 ===
# in the process.
m = self._getFactoryMethod(container, raise_exc=1)
+
if m is None:
raise 'Unauthorized', ('Cannot create %s' % self.getId())
+
id = str(id)
+
if getattr( m, 'isDocTemp', 0 ):
+ args = ( m.aq_parent, self.REQUEST ) + args
kw[ 'id' ] = id
- apply( m, ( m.aq_parent, self.REQUEST ) + args, kw )
else:
- apply(m, (id,) + args, kw)
- ob = container._getOb(id)
+ args = ( id, ) + args
+
+ id = apply( m, args, kw ) or id # allow factory to munge ID
+ ob = container._getOb( id )
+
if hasattr(ob, '_setPortalTypeName'):
ob._setPortalTypeName(self.getId())
+
return ob
InitializeClass( FactoryTypeInformation )