[Zope-CMF] Automatic id creation in invokeFactory will not work with non-standard cmf types
Richard Ettema
richard.ettema@yoursolutions.co.uk
Tue, 28 Aug 2001 13:34:31 +0100
Hi,
I have made a simple change to invokeFactory to create the new item id from
the date/time with
'id = str(int(time.time()))'. The 'id' which was passed to invokeFactory is
used as the title of the new item.
This all works ok with inbuilt CMF content types like file, document, link,
etc. But it will not work with any Products I add as a new Content Type
(These products work fine before this modification to invokeFactory).
It seems as though the original id passed to invokeFactory is passed onto
ConstructContent along with the new time/date based id I create??! This I
don't understand.
The object creation seems to have a problem in ConstructInstance in
TypesTool.py where _getOb(id) cannot find the new object (because it hasn't
been created?).
Any ideas of what I have missed, or something mysterious that is going on in
the background here.
Thanks for any help in resolving this.
Richard
def invokeFactory( self
, type_name
, id
, RESPONSE=None
, *args
, **kw
):
'''
Invokes the portal_types tool.
'''
title = id
id = str(int(time.time()))
kw['title'] = title
pt = getToolByName( self, 'portal_types' )
apply( pt.constructContent
, (type_name, self, id, RESPONSE) + args
, kw
)