I have never heard or read anything about turning acquisition 'off', and I would guess that it would not be a simple thing to do as many of the base classes used within zope inherit from or otherwise use acquisition classes (ie. acquisition is fundamental to many of the zope functions). Jonathan ----- Original Message ----- From: "R Karthick" <catchkarthick@yahoo.com> To: <zope@zope.org> Sent: July 13, 2004 1:50 PM Subject: Re: [Zope] restrictedTraverse without acquisition
hi!!
thank you for you reply.
Yeah it seems to be a good solution. but can't i just switch off acquisition in restrictedTraverse, when i need to?
regards, R K
--- Jonathan Hobbs <toolkit@magma.ca> wrote:
From: "R Karthick" <catchkarthick@yahoo.com>
i have this directory structure
/ |- clients/projects/abc/batches/001 |- wg/projects/cba/batches/100
now i am running a script python from 001 folder. now i want to check whether there is any folder called abc in wg/projects folder. i do this by a try statedment
try: foo = context.restrictedTraverse("wg/projects/abc") catch: ... # create the directory
It goes into the workgroup folder. But when it sees the project folder, through acquisition it finds the projects folder inside clients hierarchy first and finds that the folder abc is actually present.
I want context.restrictedTraverse to behave in a way that it acquire wg but after that projects should not be acquired but should follow the wg.
How about something like: (warning - untested)
foo = context.restrictedTraverse("wg/projects") found = 0 for i in foo.objectItems(): if str(i[0]) == 'abc': found = 1
if not found: ... # create the directory
HTH
Jonathan
===== with "freedom" comes great responsibilities
__________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )