Tim Hicks writes:
 > OK, I think that I am perhaps misusing zclasses then.  Here is what I
 > have.
No you did not.

 > I have a Folder that was created by using the 'Add new item' menu
 > within Zope.  This folder is called 'Site'.
 > I have a Zclass called 'theatre_class' that has "Base classes ZObject,
 > _ZClass_for_CatalogAware, _ZClass_for_DTMLDocument"....
 > Within the Folder 'Site', I have standard_html_header dtml-method ...
 > However, if I try to put <dtml-var id> into the standard_html_header,
 > I get nothing...

I analysed your problem (in Zope 2.1.6).
It is *NOT* a problem of "standard_html_header".
Instead, it is a ZCLass problem.

The id of a ZInstance created as
you described it returns "<string>". The browser shows this
as "empty" because it is a tag it does not understand and
therefore ignores.
You see it, though, when you look at the HTML source.

The reason for this strange id lies in a mismatch between
your ZClass, more precisely its __init__ method, and
the content of REQUEST:
   For some reason, your ZClass uses
   "DocumentTemplate.DT_String.__init__" as constructor.
   "DocumentTemplate.DT_String" defines a "id" function
   and lets it return the value of the "__init__" parameter
   "__name__". The default for "__name__" is, you guess it,

   "ZClass.createInObjectManager" constructs the ZInstance.
   If the instance has a 'id', it takes this id and
   ignores the 'id' passed as parameter.

   Thus, you get a ZInstance with this strange id.

I am convinced, this is a ZClass bug.
I think, that the bug results from the fact, that
the constructor for a ZCLass deriving from DTML Document
used "__name__" as "id" replacement.

The analysis provides a workaround for you.
In your ZClass constructor, add
        <dtml-call "REQUEST.set('__name__',REQUEST['id'])">
before the
        <dtml-with "<yourClass>.createInObjectManager(REQUEST['id'],REQUEST)"> 

Now, after I did some work for you, I have some tasks for you:

  * check, whether the bug is in Zope 2.2.1, too
  * if this turns out to be the case, file a bug report into
    the collector.


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to