[Zope-CMF] Re: Invoke factory?
Carl Rendell
cer@sol43.com
Mon, 1 Jul 2002 09:18:17 -0700
I'll put this on the list for consumption...
I've been working with an update package creates copies of all
items created with ZClass based products, and creates a new version
from a folder based equivalent. This is all done via a python
script implemented as an external method. It's being performed on a
rather old platforms - Zope 2.4.1/CMF 1.1 , Zope 2.4.1/CMF 1.2
In my testing I found some strange behavior.. When attempting to
create a copy of the object using invokeFactory(), I would receive
the traceback listed below.
After performing more testing, I found that invokeFactory() DOES
function in this environment, but ONLY when the portal_type is
configured to use a file based product. If the portal_type is
configured to use a ZClass based product, the traceback rears its
ugly head.
At this point I understand the circumstances for the behavior, and
have a work-around so I'm not going into the problem any deeper. To
sum up my experience...
someFolderObject.invokeFactory('myobjectid','portal_type')
Is the preferred method for adding content, but can be a challenge
to use if your products are ZClass based.
~C
On Monday, July 1, 2002, at 07:41 AM, alan runyan wrote:
> Carl,
> lets keep email on the cmf mailing list. this way people can
> benefit from
> the experiences.
> try something like
>
> someFolder.invokeFactory('myobjectid', 'News Item')
>
> ~runyaga
>
> ----- Original Message -----
> From: "Carl Rendell" <cer@sol43.com>
> To: "Alan Runyan" <runyaga@runyaga.com>
> Sent: Wednesday, June 26, 2002 10:54 AM
> Subject: Invoke factory?
>
>
>> Alan,
>>
>> I noticed that you added a comment that indicated we should use
>> invokeFactory() to add content. One thing I keep running into is..
>>
>> I can use invokeFactory for adding certain types (folders,
>> documents), but others like News Items I cannot. I keep getting a
>> KeyError warning, and the following traceback.
>>
>>
>> Traceback (innermost last):
>> File /Applications/gnomeZope/lib/python/ZPublisher/Publish.py,
>> line 223, in publish_module
>> File /Applications/gnomeZope/lib/python/ZPublisher/Publish.py,
>> line 187, in publish
>> File /Applications/gnomeZope/lib/python/Zope/__init__.py, line
>> 226, in zpublisher_exception_hook
>> (Object: LockableItem)
>> File /Applications/gnomeZope/lib/python/ZPublisher/Publish.py,
>> line 171, in publish
>> File /Applications/gnomeZope/lib/python/ZPublisher/mapply.py,
>> line 160, in mapply
>> (Object: aaaSearchTest)
>> File /Applications/gnomeZope/lib/python/ZPublisher/Publish.py,
>> line 112, in call_object
>> (Object: aaaSearchTest)
>> File
>> /Applications/gnomeZope/lib/python/Products/ExternalMethod/ExternalMethod.
>> py, line 274, in __call__
>> (Object: aaaSearchTest)
>> (Info: ((<CMFSite instance at 13071d0>,), {}, None))
>> File
>>
> /Applications/gnomeZope/lib/python/Products/GnomesExtras/Extensions/searchTe
> st.
>> py, line 72, in getItems
>> (Object: LockableItem)
>> File
>> /Applications/gnomeZope/lib/python/Products/CMFCore/PortalFolder.py,
>> line 368, in invokeFactory
>> (Object: LockableItem)
>> File
>> /Applications/gnomeZope/lib/python/Products/CMFCore/TypesTool.py,
>> line 745, in constructContent
>> (Object: LockableItem)
>> File
>> /Applications/gnomeZope/lib/python/Products/CMFCore/TypesTool.py,
>> line 474, in constructInstance
>> (Object: ElementWithAttributes)
>> File /Applications/gnomeZope/lib/python/OFS/DTMLMethod.py, line
>> 194, in __call__
>> (Object: Quote_add)
>> File
>> /Applications/gnomeZope/lib/python/DocumentTemplate/DT_String.py,
>> line 546, in __call__
>> (Object: Quote_add)
>> File
>> /Applications/gnomeZope/lib/python/DocumentTemplate/DT_With.py,
>> line 133, in render
>> (Object: Quote.createInObjectManager(REQUEST['id'], REQUEST))
>> File
>> /Applications/gnomeZope/lib/python/DocumentTemplate/DT_Util.py,
>> line 231, in eval
>> (Object: Quote.createInObjectManager(REQUEST['id'], REQUEST))
>> (Info: REQUEST)
>> File <string>, line 2, in f
>> (Object: guarded_getitem)
>> File /Applications/gnomeZope/lib/python/AccessControl/DTML.py,
>> line 104, in guarded_getitem
>> (Object: Quote_add)
>> File
>> /Applications/gnomeZope/lib/python/AccessControl/ZopeGuards.py,
>> line 151, in guarded_getitem
>> File
>> /Applications/gnomeZope/lib/python/ZPublisher/HTTPRequest.py, line
>> 897, in __getitem__
>> KeyError: (see above)
>>
>> This seems to happen in all versions of CMF
>>
>> ~C
Carl E. Rendell
Solution43
Information Distribution Consulting | "Ahhhh the power of
cer@sol43.com | acquisition" - Chef Z
>>
>
>