[Zope-CMF] [RFC] Type mess and allowed_content_types
Luca Olivetti
luca@wetron.es
Sat, 06 Jul 2002 16:49:40 +0200
Florent Guillaume wrote:
[I added numbers for reference]
>
> Today the sequence of event is:
> [ 1]- invokeFactory calls constructContent
> [ 2]- constructContent calls constructIntance
> [ 3]- constructInstance calls the constructor
> [ 4]- the constructor calls _setObject
> [ 5]- _setObject calls manage_afterAdd
> [ 6]- manage_afterAdd calls indexObject
> [ 7]- constructInstance calls _setPortalTypeName to set portal_type
> [ 8]- constructInstance calls wf.notifyCreated
> [ 9]- constructContent calls reindexObject
>
> (Note that _setPortalTypeName and wf.notifyCreated could probably be
> factored out into constructContent -- opinions on that ?)
>
> Where in this process does something go wrong for you ? It's not
> clear to me from your message from last May, which describes a
> sequence of events that don't occur anymore.
My products (the ones failing) derived from PortalFolder, PortalContent
and DefaultDublinCoreImpl (in that order). They either have no workflow
associated or they have a custom workflow created with DCWorkflow.
The problem is that upon creation they got catalogged as 'Folder'
instead of as 'MyType' (and that's after the object has been completely
created, ie, after 9). If I refreshed the catalog manually afterwards,
they got catalogged correctly. If I called _setPortalTypeName in my
constructor (with the hardwired 'MyType' string) it gets catallogged
correctly.
Somehow the call [9] to reindexObject in constructContent (which *is*
there in my version of TypesTool.py) didn't work (I don't know if it
does now).
I tried with CMFArticle (to test a product I did not write myself) and
it failed the same way, but the problem got masked as soon as you edited
it (after creation, in the initial view). In that message I explained
how to reproduce the problem.
Besides, even if it worked, between 6 and 9 (or 6 and 8 if the workflow
reindexes the object too) the object has not the correct type in the
catalog (probably it doesn't matter since the transaction isn't closed,
but still I think it's not completely right).
Anyway, constructContent and constructInstance didn't change bewteen
r1.33 (what I have) and r1.37 (the current one) so I suspect the problem
is still there.
Bye
--
Luca Olivetti