[Zope] PageTemplate API Question

Doyon, Jean-Francois jdoyon at NRCan.gc.ca
Thu Sep 20 10:14:05 EDT 2007


*slaps forehead*

Looks like the *parent* of the page template is the object!

Or I can also do pt_getContext() and get that TAL/TALES context, which
has all the goodies I want.

A good night sleep is all I needed :)

Thanks for the help!
J.F.

-----Original Message-----
From: zope-bounces at zope.org [mailto:zope-bounces at zope.org] On Behalf Of
Doyon, Jean-Francois
Sent: September 20, 2007 10:09
To: Andreas Jung; zope at zope.org
Subject: RE: [Zope] PageTemplate API Question

Well I just looked at "Using Zope Page Templates" and "Advanced Page
Templates" and "Appendix C", and although "context" is mentionned many
times (And I of course knew about that one!) it's all in the context of
TAL/TALES, which is a different beast than a code level FSPageTemplate
instance.

My FSPageTemplate instance doesn't seem to have a "context"
attribute/property or method.  I've dir()'ed it, but don't see anything
that jumps out at me as being useful for what I'm trying to do.

Thanks,
J.F.

-----Original Message-----
From: Andreas Jung [mailto:lists at zopyx.com]
Sent: September 20, 2007 09:50
To: Doyon, Jean-Francois; Andreas Jung; zope at zope.org
Subject: RE: [Zope] PageTemplate API Question



--On 20. September 2007 09:42:50 -0400 "Doyon, Jean-Francois" 
<jdoyon at NRCan.gc.ca> wrote:

> obj = request['PUBLISHED']
> print repr(obj)
>
> <FSPageTemplate at /atlas/maptext_view used for 
> /atlas/maps.mtp/environment.mtp/seaice.mtp/break-up.thm/1.mtx>
>
> I have the FSPageTemplate ... It's being applied to "1.mtx".
>
> How do I get to "1.mtx" directly, getting rid of the Page Template?
>
> I want to end up with this object:
>
> <MapTopicText at
> /atlas/maps.mtp/environment.mtp/seaice.mtp/break-up.thm/1.mtx>
>
> I want to get to the object the template is being applied TO.
>

You might read my first reply carefully :-) I told you about the
'context' object as it is present within your ZPT.
The 'context' object *IS* the object you are talking about.

(for further details -> The Zope Book with its three ZPT chapters)

-aj
_______________________________________________
Zope maillist  -  Zope at 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 )


More information about the Zope mailing list