[Zope-CMF] portal skins and containership

Peter Simmons pete@bcmpweb.com
Thu, 27 Feb 2003 14:40:31 +1300

you are right about the container always being the portal, and you amy 
already have this as well

if you run it in the context of a sub-folder and you want that folders 
object values you should use context.objectValues in stead of 

hope that helps cheers pete

Fearless Froggie wrote:

>Thanks in advance for any bright ideas anybody might
>have. If you know of any examples or tutorials that
>explain what I'm trying to do below, please point me
>to them :) Sorry this is a bit long ...
>I was trying out this script in my "custom" skins
>and realized that the "container" for this was
>actually the root of the portal itself. 
>Is that the point to the "skins"? Anything you run
>there will run as if it were running at the root of
>your portal? To run the script in your skins directory
>in the context of a subfolder of your portal, I guess
>you would just create the appropriate URL and add the
>script name at the end. 
>What if I wanted to run this script in the context of
>a subfolder in my portal? This will be running in a
>python script stored in a skin (to be specific it'll
>be part of a directory based custom CMF type) and the
>user won't necessarily be in the subfolder that I'd
>like the script to run in the context of. How would I
>run this script "objectValues(object_type)" in the
>context of that particular directory? The script won't
>be in the correct container and the user won't be at
>the correct URL.
>I tested the following:
>my_folder = 'test5' 
>in a python script and got the following error and
>Error Type: AttributeError 
>Error Value: objectValues 
>line 302, in _exec
>    (Object: test)
>    (Info: ({'script': <PythonScript instance at
>8ec04e0>, 'context': <CMFCouncilCategory
>instance at 95bfdc0>, 'container': <CMFSite
>instance at 8ffab40>, 'traverse_subpath': []}, (),
>{}, None))
>  File Script (Python), line 12, in test
>AttributeError: (see above)
>Looking at the traceback above, "context =
>CMFCouncilCategory instance": CMFCouncilCategory is my
>folder type, and I assume the url that I'm running the
>script from. "container = CMFSite instance" is the
>portal. I'm not sure exactly what the
>"traverse_subpath" is.
>The script works great with "context" or "container".
>I just can't figure out how to point it anywhere else.
>Many Thanks, Rita.
>Do you Yahoo!?
>Yahoo! Tax Center - forms, calculators, tips, more
>Zope-CMF maillist  -  Zope-CMF@zope.org
>See http://collector.zope.org/CMF for bug reports and feature requests