[Zope] Interfacing with Z SQL Method?

Art Hampton arth@pacsg.css.mot.com
Tue, 30 Nov 1999 09:55:53 -0600


I'm having problems interfacing with an SQL method I've created.

My method takes two arguments:
ids:tokens:int="" limit:int="10"

ids is a space separated list of news article category IDs (any if
empty), and limit is the maximum number of articles I want returned.

No problems so far, my method works as desired.

Problem #1:
My problem occurs with interfacing with the method.  The auto-generated
Z Search Interface can access the data just fine.

But I want to create a document method which will call the SQL method. 
No query will have been performed at this point.  I want to make a page
which retrieves the category IDs of interest for the current user, and
then uses that list for the ids parameter.  I cannot figure out how I
can set the ids parameter for the SQL method.  My impression from
reading the Z SQL Method guide is that the parameters are only taken
from the variables given in the query (not applicable for the first view
of this page), or from variables in the folder (which doesn't help me,
since the ids vary with the user, not the folder).

The following snippet of code works fine for the default arguments:
  <dtml-in SQL_GetHeadlineSummary size=20 start=qs>
    <B><dtml-var title></B>
    <UL><dtml-var body size=8 etc="..."></UL>
  </dtml-in>

What do I need to do to get it to use values that I pass in?  Or can I
do that?


Problem #2:
I'd like to pull in the headlines (discussed above) into the root level
index_html.  However, I don't want to make the above SQL method (or its
connection) available to content managers in the levels below root (for
security reasons).

The only solution I've come up with (and keep in mind that I've only
been using Zope for about 2 weeks) is to put the connection and method
in a folder under root.  But then I can't figure out how to pull the
info contained in the subfolder up into the index_html at root.

Any hints?

Thanks in advance for your help.