[Zope] Acquisition bug with ZSQL in 2.1.6

Marcus Collins mcollins@sunesi.com
Tue, 11 Apr 2000 15:54:44 +0200


Hi all

It looks like named arguments provided to ZSQL methods in Zope 2.1.6 are
incorrectly hidden by other objects with the same id in the acquisition
tree.

Here's a brief view of the relevant bits of the hierarchy:

\
|- AttributeHash (external method)
|
|-\ SQL (folder)
  |- GetRelatedArticles (ZSQL method)

SQL.GetRelatedArticles takes arguments named "AttributeHash", "limit" and
"ExcludeArticleId"

The ZSQL method works correctly in Zope versions 2.1.3 and 2.1.4, but fails
under 2.1.6 with the following traceback (this from manage_test):

Error Type: Missing Input
Error Value: Missing input variable, AttributeHash

Traceback (innermost last):
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 214,
in publish_module
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 179,
in publish
  File /usr/local/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202, in
zpublisher_exception_hook
    (Object: GetRelatedArticles)
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 165,
in publish
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: manage_test)
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 102,
in call_object
    (Object: manage_test)
  File /usr/local/Zope-2.1.6-src/lib/python/Shared/DC/ZRDB/DA.py, line 331,
in manage_test
    (Object: GetRelatedArticles)
  File /usr/local/Zope-2.1.6-src/lib/python/Shared/DC/ZRDB/DA.py, line 310,
in manage_test
    (Object: GetRelatedArticles)
  File /usr/local/Zope-2.1.6-src/lib/python/Shared/DC/ZRDB/DA.py, line 424,
in __call__
    (Object: GetRelatedArticles)
  File /usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: <string>)
  File /usr/local/Zope-2.1.6-src/lib/python/Shared/DC/ZRDB/sqlvar.py, line
168, in render
    (Object: AttributeHash)
Missing Input: (see above)

The MissingInput exception is caused because the external method expects an
argument.

In replacing <dtml-sqlvar AttributeHash type=string> with <dtml-var
AttributeHash>, I discovered that the external method was in fact being
used, rather than the value of AttributeHash that was being passed to the
ZSQL method:

  File
/usr/local/Zope-2.1.6-src/lib/python/Products/ExternalMethod/ExternalMethod.
py, line 248, in __call__
    (Object: AttributeHash)
    (Info: ((), {}, None))
TypeError: (see above)

Renaming the external method, or the argument passed to the ZSQL method,
both fixed (masked :-) the problem.

I've also confirmed that this happens in a minimal test setup, with DTML
documents instead of external methods, and with any number of arguments.

I'm pretty certain this is a bug, possibly a result of one of the
acquisition bugfixes made in 2.1.5 or 2.1.6; can anyone else confirm this
happening? If so, I'll write it up and submit to the Collector.

Many thanks again to DC and the Zope community!

-- Marcus