[Zope] tree-tag & SQL - works not properly with zope 2.1.6

Andrew Williams ajwms@visto.com
Sat, 29 Apr 2000 07:41:39 -0700


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>:&nbsp;&nbsp;<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





-----Original Message-----
From:    Philipp Auersperg zope@philosoft.at
Sent:    Sat, 29 Apr 2000 04:43:42 +0200
To:      zope@zope.org
Subject: [Zope] tree-tag & SQL - works not properly with 
zope 2.1.6


I use a recursive table to implement a hierarchical 
structure in SQL and the Zope tree tag to display it. This 
works perfect with Zope 2.0.1
recently I upgraded to 2.1.6. Since then it does not work 
correct. What did I do wrong and what can I do to correct 
the problem?

thanks in advance
phil

Here the exact description of what I did:

1. SQL statement:
----------------------
create table Item(ItemId int,parentID int,name varchar(30))

2. In Zope I defined a SQL Method called 'Item' with an 
argument called 'parentID':
------------------------------------------------------------
----
select * from Item where parentID=<dtml-var parentID>

3. I defined a DTML document to display the tree:
------------------------------------------------------------
---------
<!--#var standard_html_header-->

<dtml-let ItemID="-1">
<dtml-tree id=ItemID branches_expr="Item(parentID=ItemID)">
 <dtml-var name> </a>
<br>
</dtml-tree>

</dtml-let>
<!--#var standard_html_footer-->

----------------------------------


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