[Zope] object ID

Daniel.Weber@SEMATECH.Org Daniel.Weber@SEMATECH.Org
Mon, 03 Apr 2000 17:29:31 -0500


layout:
BaseFolder
  |Subfolder1
    Doc1
    |subfolder1_1
      Doc2
  |Subfolder_2
    Doc3

I'm using dtml-tree to render this view in frame.  The application is a error
recovery set of pages, where the first sub-folder is an area, second level is a
tool, and third is sub-system.

Since all the pages are the same except for the recovery procedure, I stored the
procedure in a property of the dtml-document.  (there's probably a better way of
doing it, but I didn't know how to use a tree with anything but objects)

The tree is formed from objects('dtml-document', 'folder').  All the code is
stored in dtml-methods in the root folder of the tree, and hence accessible to
all areas.

The dtml-documents several folders deep need to be edited by others.  Since they
don't know zope,html and barely Word, I have a method which displays a textarea
control and lets them type in the recovery procedures.  This procedure is then
displayed inside a <PRE> tag.  No coding required....   each page also has an
edit link.  The link is to a method in the top level of the tree.

The first dtml-method displays a form to modify the properties.  it then calls
another method, located in the same top-level folder to actually make the
changes.

If I simply use <dtml-call "Manage_changeProperties" from the second method, the
properties of the first containing folder are modified instead of the document
(even though the properties aren't defined there, go figure).

So, the call stack is:
BaseFolder <-1/2
  |Subfolder1  |  <-- properties changed here.
    Doc1 -------
    |subfolder1_1
      Doc2
  |Subfolder_2
    Doc3

Original Document -> method 1 -> method 2 (which changes document ).  Except it
changes the folder instead.

No combination of <dtml-with> I've tried today (and believe me, I've tried a
*lot*) has given me what I need.

For some reason the second method is acquiring the folder instead of the
document.  I don't know if that's because it's in a tree, the sort order the
second call or the frame it's in.

The only way I found to get around this is to have the first method call the
procedure via HTTP_REFERER and put my modifying code at the top.  This works,
but I'd like to do some error-checking kinds of things.

I appreciate the method explanation - It makes more sense now.


> -----Original Message-----
> From: Tres Seaver [mailto:tseaver@palladion.com]
> Sent: Monday, April 03, 2000 3:51 PM
> To: zope@zope.org; Daniel.Weber@SEMATECH.Org
> Subject: Re: [Zope] object ID
> 
> 
> Daniel.Weber@SEMATECH.Org asked:
> > 
> > I have a series of pages that changes the attributes of a 
> dtml-document.
> > For manage_changeProperties to work I need the object ID.  
> Passing in
> > <dmtl-var id> doesn't seem to work because I'm not in the 
> same folder.
> > 
> > Is there any way to get the unique id of an object that I 
> can pass along
> > and use with a <dtml-with> tag?
> 
> Hmm, I guess maybe I don't get your intent.  Suppose I have a 
> DTML Document,
> 'has_prop', with a property named 'aProp', currently set to 
> 'XXX'.  Its body
> looks like::
> 
>  <dtml-var standard_html_header>
>  <h2><dtml-var title_or_id></h2>
>  <p> This is the <dtml-var id> Document.  
>      Property 'aProp' has value <strong><dtml-var aProp></strong>.</p>
>  <dtml-var standard_html_footer>
> 
> I have a DTML Method (*not* a document, this is important!), named
> 'change_prop', which looks like this::
> 
>  <dtml-var standard_html_header>
>  <dtml-call "manage_changeProperties( aProp='YYY' )">
>  <dtml-call "RESPONSE.redirect( absolute_url() )">
>  <dtml-var standard_html_footer>
> 
> If I traverse through the DTML Document and then call the 
> DTML Method, Zope does
> the Right Thing (TM):
> 
>  URL:  http://localhost:8080/has_prop/change_prop
> 
> leaves me showing the body of has_prop, whose property 
> 'aProp' is now 'YYY'.  I
> don't have to mess with the id of the document at all.  The 
> key is that
> change_prop, a DTML Method, can't have properties: it uses 
> whatever properties
> belong to (or are acquired by) its "caller."  In this case, 
> the caller is
> has_prop, so has_prop's properties get changed.
> 
> Does that help any?
> 
> Tres.
> -- 
> =========================================================
> Tres Seaver  tseaver@digicool.com   tseaver@palladion.com
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>