[Zope] Rendering PageTemplateFile

sean.upton@uniontrib.com sean.upton@uniontrib.com
Wed, 25 Jun 2003 12:47:30 -0700


Online ZDG chapter on acquisition should cover: Implicit.__of__()

Any class inheriting from Implicit has the __of__() method, for wrapping its
instances in context and containment, for example:

app = Zope.app()
portal = app['myCMFSite'].__of__(app) 
##portal should acquire from parent folder

Note, in this case, portal is NOT the CMF site object, but a wrapper that
contains the CMF site object (aq_base) and proxies calls to it, and further
up the chain to the parent (aq_parent).  In your case the template object
needs to actually be a wrapper containing a PageTemplateFile object, and
reference to parents to try when it's deemed necessary to move "upward" on
the so-called namespace stack.

Sean

> -----Original Message-----
> From: Max M [mailto:maxm@mxm.dk]
> Sent: Wednesday, June 25, 2003 12:37 AM
> To: Dieter Maurer
> Cc: zope@zope.org
> Subject: Re: [Zope] Rendering PageTemplateFile
> 
> 
> Dieter Maurer wrote:
> 
> > You page template is not acquisition wrapped (and therefore cannot
> > define "here", "container", ...
> > 
> > Try:
> > 
> >     pt= PageTemplateFile(...).__of__(self)
> 
> Dieter, is __of__() documented anywhere?
> 
> Is it a new method? I haven't seen it before.
> 
> regards Max M
> 
> 
> _______________________________________________
> 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 )
>