[Zope-dev] Acquisition/cDocumentTemplate bug

Dieter Maurer dieter@handshake.de
Mon, 17 Jul 2000 11:53:09 +0200 (CEST)


Recently, several posters have reported strange "AttributeError __call__"
exceptions.

The most precise was a report by Oleg Broytmann:
  
   /index_html				DTML Document
      <dtml-var standard_html_header>
   /standard_html_header		DTML Method
      <dtml-with sub></dtml-with>
   /sub			   		Folder

  When he calls "/sub/index_html", he gets this
  "AttributeError __call__" for "sub".

  He observed the problem on Zope 2.1.4 and 2.2a4.


I partially analysed this problem report under Zope 2.1.6:

  In "MM_cget", "sub" is retrieved as an "ImplicitAcquirerWrapper"
  (correct). 

  In line 373, however, "PyCallable_Check(sub)" returned "1",
  which is probably wrong, because a folder is not callable.
  The "ImplicitAcquirerWrapper"'s "tp_call" mislead
"PyCallable_Check".

  In line 376, the attribute "py_isDocTemp" is looked up
  and succeeds. Therefore, the folder "sub" is seen as
  a Document Template, which definitely is not true.
  The following call fails because it arrives at CallMethodO in
  "Acquisition.c:119" which looks for a non-excisting "__call__" method.



Dieter