Hi Zdevs,

I posted a message to [EMAIL PROTECTED] and then later
figured out the problem and now feel that the issue
belongs in Zope-Dev, so here it goes.

Submitted for your approval...

I think that I have found an interaction between changes made in
manage_addZCatalog (lib/python/Products/ZCatalog/ZCatalog/py)
and the Renderable ZClass product.  It's also possible that this
interaction will affect other things as well.

The new version of method 'manage_addZCatalog' has calls to str()
near its beginning.  The older (2.1.6) does not.  The Renderable
product overrides str to do its work.  This gets _very_ messy
when you initialize a catalog in the xxx_add dtml method for a
ZClass (that is, if you create an instance of the ZClass and the _add
method instantiates a ZCatalog instance.) and the ZClass itself is

The manage_addZCatalog method ends up invoking the str() method
that's in the Renderable product.  This code attempts to publish(?) the
a dtml method named render (this is what it does by default).
In my case, the dtml method tries to query the created ZCatalog instance.

This does not work! since the ZC instance isn't actually created since the
_add method has not completed(?).
So the render dtml method borks with an attribute error.
Correct me if I have reverse-engineered these conclusions from looking
at the traceback and made a logic error....

As one can see from the traceback attached to the end of this email,
the manage_add methof (I put XXXXX near where this mess begins)
warps into the render dtml method at line 112 of manage_addZCatalog,
which is the first str() (can be seen in the src).  This ends up in
an External Method, rendercal.py (last line of traceback).  If you were
to look there you'd se that it's doing a Catalog.searchResults().

**SO** it appears as if you cannot instantiate a ZCatalog in the _add
dtml method of a ZClass IFF the ZClass inherits from Renderable AND
if the render dtml method of the class (required by Renderable) uses
the ZCatalog.

This interaction may very well affect other products as well. But right now
my brain hurts.  Excuse me if someone else reported this, but I haven't
seen mention of it so far.

This should be easy to reproduce.  On a 2.2 system that has the Renderable
ZClass product installed, install EventFolder (it's on Zope.org, there's a .zexp
and some External Methods in the tgz file, just untar it in the Zope root and
copy the .zexp to the import dir and import it).  Try to create an
instance and you should get this error.

It seems to me the only solution is to recreate the class without the
Renderable inheritance.  Not a big deal to lose....  But what other
schizoZopia is waiting in the future.....

Jeff Sasmor

Traceback (innermost last):
  File /usr/local/Zope220/lib/python/ZPublisher/Publish.py, line 222, in publish_module
  File /usr/local/Zope220/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/local/Zope220/lib/python/Zope/__init__.py, line 221, in 
    (Object: RoleManager)
  File /usr/local/Zope220/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/local/Zope220/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: EventFolder_add)
  File /usr/local/Zope220/lib/python/ZPublisher/Publish.py, line 112, in call_object
    (Object: EventFolder_add)
  File /usr/local/Zope220/lib/python/OFS/DTMLMethod.py, line 167, in __call__
    (Object: EventFolder_add)
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_String.py, line 502, in 
    (Object: EventFolder_add)
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_Let.py, line 147, in render
    (Object: folder="EventFolder.createInObjectManager(REQUEST['id'], REQUEST)")
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_With.py, line 146, in render
    (Object: folder)
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval
manage_addProduct['ZCatalog'].manage_addZCatalog(this(),'Catalog','EventCatalog' ))
    (Info: this)
  File <string>, line 0, in ?
  File /usr/local/Zope220/lib/python/Products/ZCatalog/ZCatalog.py, line 112, in 
????????????how did we get here vvvvvvvv
  File /usr/local/Zope220/lib/python/Products/Renderable/Renderable.py, line 17, in 
    (Object: Renderable)
  File /usr/local/Zope220/lib/python/OFS/DTMLMethod.py, line 167, in __call__
    (Object: render)
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_String.py, line 502, in 
    (Object: render)
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_With.py, line 146, in render
    (Object: ZopeTime)
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_Let.py, line 147, in render
    (Object: tdate="'%s/%s/1' % (tyear,tmonth) "
          this_month="'%s/%s' % (tyear,tmonth) "
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_Let.py, line 147, in render
    (Object: smeth="dateSearch.absolute_url()")
  File /usr/local/Zope220/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval
'showyear' , moderated))
    (Info: smeth)
  File <string>, line 0, in ?
  File /usr/local/Zope220/lib/python/Products/ExternalMethod/ExternalMethod.py, line 
270, in __call__
    (Object: renderMonth)
    (Info: ((DateTime('2000/07/01'), 'http://www.ptang.com/test/sss/dateSearch', 
'#000000', '#ffffff', '#ffffff',
'#000000', 'showyear', 'on'), {}, None))


  File /usr/local/Zope220/lib/python/Products/EventFolder/Extensions/rendercal.py, 
line 97, in renderMonth
    (Object: Renderable)
AttributeError: (see above)

Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError
Error Value: Catalog

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

Reply via email to