[Zope] Object Acquisition
Thierry FLORAC
thierry.florac@onf.fr
Wed, 26 Feb 2003 11:24:55 +0100
On Wednesday 26 February 2003 11:09, Samir Mishra wrote:
> Sorry to be a bother, seems trivial, just can't seem to find the right
> syntax for it...
>
> How do I check if a particular object exists ONLY in the current folder
> (the context) and is not being acquired?
>
> The script I have is -
>
> ==================================
>
> """
> Add single folder along with manager/user programmatically to current
> folder Parameter: folderList (a list)
> """
>
> curFolder = context #current context, where the user is
>
> folderName = folderList[0]
> folderTitle = folderList[1]
>
> if not hasattr(curFolder, folderName):
> ## create the folder
> curFolder.manage_addFolder(folderName, folderTitle, 0, 1)
> return 1
> else:
> return 0
I think you could make it work with :
if folderName not in curFolder.objectIds():
...
or
if not hasattr (curFolder.aq_explicit, folderName):
...
Not tested :-((
Thierry.