[Zope-dev] DTML Zclass ID bug - HELP!

Michel Pelletier michel@digicool.com
Sun, 17 Oct 1999 13:36:34 -0400


Anthony Pfrunder wrote:
> 
> Hi,
> 
> I've run into a really annoying bug and was wondering if it is fixed in
> the CVS version (I don't have direct internet access to check).
> 
> Create a new Product containing a Zclass subclassing from the DTML
> Document or Method.  Add a Python or DTML Method which does:
> 
>         This document is <dtml-var id>
> 
> Then, add an instance of this Zclass.  When you VIEW it you get:
> 
>         This document is <cstring ...>
> 
> AND when you edit it the ID is empty.  All references to the ID and
> related internal variables return CSTRING or cause tracebacks.  How do i
> get the REAL id?

Did you try <dtml-var document_id>?

> Also, I can get the unprocessed content via self.read() but how do I get
> the processed data?  repr, `..` and index_html all give weird tracebacks.

You have to call yourself with a context or mapping:

rendered = self(self)

would be an interesting combination if self could satisfy it's own DTML
needs.

> Just a thought - what about adding a Storage/Zclass mixin class for people
> doing combo Product / ZClass systems.  Hence, the ZClass gets stored
> within a ZODB in the appropiate Product directory hence reducing
> installation hassles.  This also means we can just zip up the Product
> directory to automatically include ZClasses [looks at the ZODB experts on
> Zope-dev].

My brain hurts when I even try to think about it.  Without a good model,
I have no idea.  Give it a whack if you think it can happen.

-Michel