Maik Jablonski writes:
Clemens Robbenhaar wrote:
Maik Jablonski writes:
Thierry Florac wrote:
Given an object accessed directly (for example, through a call to Catalog().getObject()), how can I get access to his parent folder in a Python script or a Zope product ?? What the property or method name pointing to the folder the object ?
try:
.aq_parent
Well, in a Zope product on the file system code.
Maybe even '.aq_inner.aq_parent' is better to remove any acquisition context? (Thierry: You can look this up in the ZopeDevelopers guide, chapter Acquisition, if You wonder what this means ;-)
If you want no acquisition context, then .aq_inner.aq_parent is the way you should do it, that's right. But in most cases you want acquisition, I would guess...;-)
In case one gets items from a catalog I am wondering what the acquisition context is. Hm, looking at the code in ZCatalog/CatalogBrains.py it seems there is no difference between the object with and without acquisition, as this is retrieved via "unrestrictedTraverse" on the "getPath", which means that the object is returned in the context is has been indexed, not the current context. Or I have missed something here ...
In a Python script, the aq_* variables are not accessible. One could use an external method or fumble with 'getPhysicalPath' and 'restrictedTraverse', which is both somewhat cumbersome, however.
Sorry, but that's not true. You can access .aq_parent without problems in PythonScripts or DTML. I use it every day.
Er, indeed. I must have confused this with something else, sorry :( cheers anyway, clemens