PageTemplate API Question
If I have an object that is represented like this: <FSPageTemplate at /atlas/maptext_view used for /atlas/maps.mtp/environment.mtp/seaice.mtp/break-up.thm/1.mtx> How do I get to the object the template is being applied to (i.e. "1.mtx")? Thanks :) Jean-François Doyon Data Dissemination Division | Division de la diffusion des données Data Management and Dissemination Branch | Direction de la gestion et de la diffusion des données Earth Sciences Sector | Secteur des sciences de la Terre Natural Resources Canada | Ressources naturelles Canada Ottawa, Canada K1A 0E9 jdoyon@nrcan-rncan.gc.ca Telephone | Téléphone 613-992-4902 Facsimile | Télécopieur 613-947-2410 Teletypewriter | Téléimprimeur 613-996-4397 Government of Canada | Gouvernement du Canada
huh --On 19. September 2007 17:00:03 -0400 "Doyon, Jean-Francois" <jdoyon@NRCan.gc.ca> wrote:
If I have an object that is represented like this:
<FSPageTemplate at /atlas/maptext_view used for /atlas/maps.mtp/environment.mtp/seaice.mtp/break-up.thm/1.mtx>
How do I get to the object the template is being applied to (i.e. "1.mtx")?
'context' - as documented in any ZPT related documentation (e.g. the three ZPT chapters of the "The Zope Book": <http://www.plope.com/Books/2_7Edition> -aj
Sorry, I should've been clearer, I mean from product code (hence the API part of the subject line :) ... As best I can tell that object doesn't have a context attribute/property ... There's a bunch of "get*" methods, but nothing is jumping out at me as being what I want either ... So I have request['PUBLISHED'] that is the template being applied to an object, and I want the object itself, in product code. I suppose I can go digg around to see how the TALES engine gets it's context variable ... Thanks, J.F. -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Andreas Jung Sent: September 20, 2007 00:50 To: Doyon, Jean-Francois; zope@zope.org Subject: Re: [Zope] PageTemplate API Question huh --On 19. September 2007 17:00:03 -0400 "Doyon, Jean-Francois" <jdoyon@NRCan.gc.ca> wrote:
If I have an object that is represented like this:
<FSPageTemplate at /atlas/maptext_view used for /atlas/maps.mtp/environment.mtp/seaice.mtp/break-up.thm/1.mtx>
How do I get to the object the template is being applied to (i.e. "1.mtx")?
'context' - as documented in any ZPT related documentation (e.g. the three ZPT chapters of the "The Zope Book": <http://www.plope.com/Books/2_7Edition> -aj
--On 20. September 2007 08:54:20 -0400 "Doyon, Jean-Francois" <jdoyon@NRCan.gc.ca> wrote:
Sorry, I should've been clearer, I mean from product code (hence the API part of the subject line :) ... As best I can tell that object doesn't have a context attribute/property ... There's a bunch of "get*" methods, but nothing is jumping out at me as being what I want either ...
So I have request['PUBLISHED'] that is the template being applied to an object, and I want the object itself, in product code.
No idea what you mean or want... -aj
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. J.F. -----Original Message----- From: Andreas Jung [mailto:lists@zopyx.com] Sent: September 20, 2007 08:57 To: Doyon, Jean-Francois; Andreas Jung; zope@zope.org Subject: RE: [Zope] PageTemplate API Question --On 20. September 2007 08:54:20 -0400 "Doyon, Jean-Francois" <jdoyon@NRCan.gc.ca> wrote:
Sorry, I should've been clearer, I mean from product code (hence the API part of the subject line :) ... As best I can tell that object doesn't have a context attribute/property ... There's a bunch of "get*" methods, but nothing is jumping out at me as being what I want either ...
So I have request['PUBLISHED'] that is the template being applied to an object, and I want the object itself, in product code.
No idea what you mean or want... -aj
--On 20. September 2007 09:42:50 -0400 "Doyon, Jean-Francois" <jdoyon@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
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@zopyx.com] Sent: September 20, 2007 09:50 To: Doyon, Jean-Francois; Andreas Jung; zope@zope.org Subject: RE: [Zope] PageTemplate API Question --On 20. September 2007 09:42:50 -0400 "Doyon, Jean-Francois" <jdoyon@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
*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@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Doyon, Jean-Francois Sent: September 20, 2007 10:09 To: Andreas Jung; zope@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@zopyx.com] Sent: September 20, 2007 09:50 To: Doyon, Jean-Francois; Andreas Jung; zope@zope.org Subject: RE: [Zope] PageTemplate API Question --On 20. September 2007 09:42:50 -0400 "Doyon, Jean-Francois" <jdoyon@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@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 )
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Doyon, Jean-Francois wrote:
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.
You want the non-containment aqcuisition parent: from Acquisition import aq_parent return aq_parent(template) Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG8pzD+gerLs4ltQ4RAhmIAJ9oF4dHOytzxeU5cQdRG+BkODylXQCfYcFV GwhLEAS518lDqMIf1hY8lpY= =sfnT -----END PGP SIGNATURE-----
participants (3)
-
Andreas Jung -
Doyon, Jean-Francois -
Tres Seaver