[Zope] tree-tag & SQL - works not properly with zope2.1.6

Andrew Williams ajwms@visto.com
Mon, 01 May 2000 06:12:32 -0700


Philipp:

I am running Zope 2.1.6; here is how I have my tree stuff 
setup (now that I'm in the office and can look at my code):

Database:  
----------
Objectid as String, Primary Key
Parentid as String
---------

SQL Method:
------------
Name: q_associativeprimary

Arguments: parentid

Query parameter:
select objectid
from t_associativeprimary
where 
<dtml-sqltest parentid type=string>
-------------

DTML Method:
--------------
  <dtml-let objectid=platformadmin>
  ...html stuff...
    <dtml-call "FSSession.set('pa',platformadmin)">
    <dtml-tree id=objectid 
branches_expr="q_associativeprimary(parentid=objectid)" 
leaves=q_results_dtml urlparam="pavar=1">
      <B><dtml-var objectid></B>
    </dtml-tree>
  ...more html stuff..
  </dtml-let>
---------------

q_results_dtml simply uses the objectid to lookup some 
values in the database and display them.

Everything works good for me.  The tree is displayed and 
expand_all and collapse_all works (I patched treetag.py).  
The only thing which doesn't happen is expand_all doesn't 
expand the leaves.  When I get a chance, I'm going to look 
into that part.

Hope that helps...

Andrew


-----Original Message-----
From:    Philipp Auersperg zope@philosoft.at
Sent:    Mon, 01 May 2000 02:24:07 +0200
To:      ajwms@visto.com
Subject: Re: [Zope] tree-tag & SQL - works not properly 
with zope2.1.6


Dear Andrew!

Thanks for your answer, but the problem still remains the 
same.

Did you try out your code snippet, if yes with which zope 
version?

thanks in advance
phil

*********** REPLY SEPARATOR  ***********

On 29.04.00 at 07:41 Andrew Williams wrote:

>Try this:
>
>SQL Method:
>-----------
>Name:  itemquery
>Arguments: parentID
>Query:
>SELECT item.itemid
>FROM item
>WHERE <dtml-sqltest parentID type=int>;
>-----------
>
>DTML Method:
>------------
>..stuff
><dtml-let ItemID="-1">
><dtml-tree id=ItemID branches_expr="itemquery
>(parentID=ItemID)">
> <a><dtml-var ItemID>:  <dtml-var name></a>
><br>
></dtml-tree>
>
></dtml-let>
>..more stuff
>------------
>
>It looks like your SQL-Query is where the problem is:
>where parentID=<dtml-var parentID>
>when called by the dtml-method is basically going to be
>where parentid=parentid which is a circular reference.
>
>If you change the sql statement to the one above, then sql-
>method will evaluate out to:
>where parentid=item
>which is what you want.
>
>Hope this helps.
>
>Andrew
>
>


__________________________________________________________________________
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.