[Zope-CMF] Re: Help needed - creating objects using a specified path string or tuple

AltKey myaltkey at msn.com
Fri Feb 6 19:58:14 EST 2004


Paul Winkler wrote:
> On Fri, Feb 06, 2004 at 05:11:39PM +0800, altkey wrote:
> 
>>>I'm not sure what you expected. Were you expecting the first 
>>>tuple of output to be like this?
>>>
>>>(	'desired path=/DF/A_Test_Folder',
>>>	'supplied context=/DF/A_Test_Folder',
>>>	'actual path=/DF/A_Test_Folder/01_project'),
>>>
>>>
>>
>>yes, that's what i hoped to see.
>>
>>
>>>If so, then clearly something goes wrong the
>>>very first time through.
>>>So, what are the your arguments?
>>>i.e. can you tell me the values of:
>>>
>>>self.getPhysicalPath()
>>>objectList[0].getPhysicalPath()
>>>
>>
>>'/'.join(self.getPhysicalPath()) = '/DF/A_Test_Folder'
> 
> 
> that looks ok then.
>  
> 
>>objectList[0] is just a list with 2 elements
>>[some-meta-data, come-content-data]
> 
> 
> right, I misunderstood what objectList consisted of.
> So what's the PATH of the first element?

The PATH for the first element ('/'.join(metadata['PATH'])) is 
'/DF/Current/01_folder'

>  
> 
>>PS:
>>
>>as an experiment i used manage_addFolder(name,<insert Dublic Core Title 
>>here>) and it placed the objects in the correct setting. I am feeling 
>>fairly unsure about the 'meaning' of invokeFactory now ...
> 
> 
> It looks like it should do what you want.
> grep reveals it to be in CMFCore/PortalFolder.py
> around line 341 (as of cmf 1.4.2).
> 
> This is really puzzling, if manage_addFolder works then
> I don't see why invokeFactory wouldn't either.
> 
> I think it's time for you to meet your new friend, the 
> interactive debugger :-)
> http://zope.org/Members/klm/ZopeDebugging/FrontPage
> 

The trouble with manage_addFolder(...) is that it does not complete a 
transaction until the script running it finishes, so the newly added 
folder is not available to me until after the script is done, but I want 
to modify the content of the new folder in the script i am running. 
invokeFactory(...) on the other hand does complete the transaction 
immediately so i can perform the updates i want.

I'll take a look at the debugger :-)

It is a pity that there isn't some example documentation for the proper 
use of invokeFactory, constructInstance, and constructContent in 
external methods.




More information about the Zope-CMF mailing list