[Zope] Wrapping pre-existing content

Chris Withers chrisw@nipltd.com
Thu, 08 Mar 2001 13:44:41 +0000


Phil Harris wrote:
> 
> I've got a naive Python Script (restricted) that looks like this:
> 
> #===================
> import string
> 
> a=context.restrictedTraverse(string.join(traverse_subpath,'/'),0)
> if a.meta_type == 'Folder':
>   a=a.default_html
> 
> h=context.aspire_html_header_orig(None,context)
> f=context.aspire_html_footer_orig(None,context)
> c=a(None,context)
> 
> return h+c+f
> #===================
> 
> However this has problems when rendering the header and footer (h & f), it's
> somehow losing the namespace and things such as PARENTS are no longer
> available.
> 
> Any ideas?

Yup, you need to bind the namespace in the above python script's bindings tab
and then pass it wherever that python script is beind called, then change the
last three lines to be like:

> h=context.aspire_html_header_orig(None,_)
> f=context.aspire_html_footer_orig(None,_)
> c=a(None,_)

...where _ is whatever you've bound the namespace to :-)

cheers,

Chris