Context - how can I be here when I'm there
Hello all, First post. I've read (past tense) tfm, but still don't know quite how to do this. I'm writing a Python script called by a zpt page. How can I obtain the resource/object which was first called by the visitor to the site, from the python script. I've tried context.PUBLISHED , but that is not quite what I want, as it gives more of a url style. I'm tring to get something that I can compare to an objectValues() list. I had two ideas already, one was to call back to zpt and then do a comparison to /here, the other was to pass /here from my zpt page to the Python script. I think either of those might work, but would like to know if there is a way to access the "/here" from Python? -------------------- Chris Matheson
--On 11. August 2005 11:42:05 -0400 Chris Matheson <chris@centralfrontenac.com> wrote:
Hello all,
First post. I've read (past tense) tfm, but still don't know quite how to do this.
I'm writing a Python script called by a zpt page. How can I obtain the resource/object which was first called by the visitor to the site, from the python script. I've tried context.PUBLISHED , but that is not quite what I want, as it gives more of a url style. I'm tring to get something that I can compare to an objectValues() list.
'context' - as the name says - is the current object your dealing with. If you call TTW /path/to/x/y/z/your_zpt then 'context' is the object behind the URL /path/to/x/y/z -aj
Chris Matheson wrote at 2005-8-11 11:42 -0400:
... First post. I've read (past tense) tfm, but still don't know quite how to do this.
Please, be very precise when you ask questions.
... I've tried context.PUBLISHED
I doubt that you did that -- as it should be "context.REQUEST.PUBLISHED". , but that is not quite what I want, as it gives more of a url style What does "gives more of a url style" mean?
I'm tring to get something that I can compare to an objectValues() list.
Another vague description: What should "compare to an objectValues() list" mean? Comparison operators are usually "=", "!=", "<", "<=", ">=", ">". I doubt you mean one of them...
I had two ideas already, one was to call back to zpt and then do a comparison to /here, the other was to pass /here from my zpt page to the Python script. I think either of those might work, but would like to know if there is a way to access the "/here" from Python?
The most natural way would be to pass it into your Python Script. In special cases (when you are interested in the objects visited during URL traversal), then the following request variables may help: PUBLISHED the (final) object located via URL traversal PARENTS a list of objects visited during URL traversal in reverse order and without the final object (which is in "PUBLISHED"). This means "PARENTS[0]" is the second to last object visited during URL traversal, "PARENTS[-1]" is the root object. -- Dieter
participants (3)
-
Andreas Jung -
Chris Matheson -
Dieter Maurer