[Zope] Dtml-tree and manage_delObjects funny behavior

Rogerio Atem de Carvalho ratem@censa.com.br
Sat, 14 Jul 2001 18:13:10 -0300 (BRT)


Hi all,

I am posting this message again, since I modified my code, without progress...

I use dtml-tree to show a hierarchy of folders containing exclusively instances 
of, say,MyZClass. The user can use the tree structure to add and update 
MyZclass instances,which properties are set by acquisition. 

A funny thing happens when I try do delete an instance: the folder containing 
the instance "looses" the id showed on the tree (its path become something like 
127.0.0.1/Cities//) and the actual object that I would like to delete is not 
destroyed at all!

The codes are:

The tree:

<dtml-var standard_html_header>
<dtml-tree Cities branches=objectValues sort=id>
 <img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>">
 <dtml-if "meta_type=='Folder'">
  <dtml-var id>
  <a href="<dtml-var tree-item-url>/frmAdd"><+></a> -->adds instances of 
MyZclass in the folder
 <dtml-else>
  <a href="<dtml-var tree-item-url>"><dtml-var title></a>
  <a href="<dtml-var tree-item-url>/frmDelete"><-></a> -->deletes the current 
MyZclass instance
 </dtml-if>
</dtml-tree>
<dtml-var standard_html_footer>

The "destroy" method (metDestroy): 

<dtml-with "_.getitem(city)"> 
 <dtml-call "_.getitem(category).manage_delObjects(['id'])">
</dtml-with>
<dtml-var id> ------->shows the desired id (the Zclass instance id)

OBS.: I tried also:

<dtml-with "_.getitem(city)"> 
 <dtml-with "_.getitem(category)">
  <dtml-call "manage_delObjects(['id'])">
 </dtml-with>
</dtml-with>

this method is called by another method which asks for confirmation(frmDelete):

<dtml-var standard_html_header>
<FORM action="metDestroy">
 Are you sure?<br>
 "<dtml-var summary>"<br>       -->only shows the object summary property
<input type=submit value=" Remove? ">
</form>
<dtml-var standard_html_footer>

When that strange behavior started, I wrote some code to show the actual
"id" being used in <dtml-call "manage_delObjects(['id'])">, 
and it was the MyZclass instance id, so there is no problem with ids (I think!).

I used this method as both a MyZclass method and as a method in my main folder 
(Cities). 
The behavior was the same...
I had to delete the folder where I tried to delete the instance so that the 
tree could 
"remember" the real folder structure (that was not affected!)

The folder structure is
 Cities
   City1
     Category1
       MyZclass1
       MyZclass2
       MyZclass3
         ...
     Category2
       MyZclass4
       MyZclass5
       MyZclass6
         ...
     Category3
         ...
   City2
      ...
   City3
      ...
    ...

One more thing:
how can I refresh the tree after deleting or adding an object? I mean, how can
I redirect from the Add/Delete forms to the tree form and refresh the tree?

Thanks in advance,

Rogerio