[Zope3-dev] queryAdapter via __conform__
Dominik Huber
dominik.huber at projekt01.ch
Mon Feb 23 12:50:29 EST 2004
If queryAdapter is called by a view, the result is an unproxied adapted object.
If __conform__ is invoked during this call, the resulting adapted object is proxied.
I would suggest to extend queryAdapter by a removeAllProxies to provid a consistent behavior. Thus for example
the __conform__ mechansim could also used in the widget framework (editview).
I will checking this changes if nobody has objections.
Regards,
Dominik
see ..\src\zope\component\__init__.py
def queryAdapter(object, interface, default=None, name='', context=None):
[...]
conform = getattr(object, '__conform__', None)
if conform is not None:
try:
adapter = conform(interface)
except TypeError:
[...]
else:
if adapter is not None:
# CHANGE
from zope.proxy import removeAllProxies
return removeAllProxies(adapter)
if interface.isImplementedBy(object):
return object
return queryNamedAdapter(object, interface, name, default, context)
More information about the Zope3-dev
mailing list