[Zope-DB] ZPT, ZSQL & Proxy-Roles

Charlie Clark charlie@begeistert.org
Fri, 10 Jan 2003 10:58:08 +0100

Dear list,

as part of my application users have the opportunity to have save report 
profiles and have them sent regularly by e-mail. I'm using Xron to do this 
which while far from perfect seems adequate once the Proxy roles have been 
configured correctly. There seems to be a problem, however, when it comes 
to generating the reports - it seems that PageTemplates have a really 
restricted status and can't even run ZSQL-queries: I get the message that I=
can access "results in this context". This is made worse by the fact that 
they cannot have proxy roles. I've read somewhere about a workaround for 
this being a PythonScript to collect the results for the PageTemplate and 
had some success with this but couldn't get it do everything I wanted.

My current workaround will be to avoid Xron and use a cron-controlled shell=
script to access a specially-prepared web-page to do the work: View-rights 
seem to be enuff. I don't like this very much but can't think of anything 
better at the moment. Any suggestions?

The reports look a bit like this:

Name & Address=09| Classes  | More Info
Charlie Clark=09| English
Helmholtzstr. 20| German
=09=09=09=09| French
Johnny Clark=09| English
Newlyn Drive 23 | Gaelic

The problem is "classes". This is an n-m relation between the users and the=
classes and is currently solved by an ZSQL-call in each line of the ZPT 
produced by the initial request.
<tr tal:repeat=3D"user results">
=09<td tal:content=3D"user/username">
=09<td tal:define=3D"classes python: here.SQLcall(key=3Duser.key)"><div 
tal:repeat=3Dclass classes"><br tal:content=3D"class/name"></div></td>

As the reports can be quite long (up to 100 records at the moment and 
possibly more in the future) this looks like it could soon become a 
bottleneck but I can't see a way of combining the calls in SQL. But there 
must be a way, a good one at that...

thanx very much