[Zope-DB] Access ZPT variable from ZSQL

Philip Kilner phil at xfr.co.uk
Wed Nov 3 10:22:33 EST 2004


Hi Charlie,

Thanks for coming back to me...

>>I have a nested recordset.
>>
>>In the "inner" element, I'm trying to filter on a variable defined in
>>the outer ZPT. If I ask ZPT to parrot the variable back at me, it has
>>it. If I try to filter on it, it tells me it is not defined.
>>
>>Where am I going wrong?
>>
>>Normally, I would stuff it in the request, but this value changes over a
>>single page...
> 
> not clear what you mean here. Can you give some code?
> 

Sorry - was a rushed question, as I was on my way out of the door.

- I have three tables in my dB, which represent a hierarchy. For ease, 
let's call them G(randfather), F(ather) and S(on).
- Within each row of the "G" recordset, I list the related "F" records, 
within each row of each "F" recordset I list the "S" records.
- I use a common template for each level, and pass parameters to it from 
it's parent.
- In this case, the "G" recordset is filtered by a request variable - 
easy. Let's say our Grandfathers are Tom, Dick and Harry - so in the 
"Tom" row, I want to nest a list of Tom's children from the "F" recordset.
- In the ZPT, I can print out the variable ("Tom"), no problem.
- In the ZSQL, I'm trying to figure out how to access this variable.

In fact, I've got around this by calling the ZSQL method from the ZPT 
with explicit parameters: -

<div tal:define="trackelements 
python:here.qual_track_element_recordset_sql(TrackRef=TrackRef)">

However, this is putting some non-presentation logic in my ZPT which 
doesn't feel right - so I'd like to be able to access it directly from 
the ZSQL if I could...

-- 

Regards,

PhilK

Email: phil at xfr.co.uk / Voicemail & Facsimile: 07092 070518

"Work as if you lived in the early days of a better nation." - Alasdair Gray


More information about the Zope-DB mailing list