[Zope3-checkins] CVS: Zope3/src/zope/proxy - __init__.py:1.7
Jim Fulton
jim@zope.com
Tue, 1 Jul 2003 19:27:08 -0400
Update of /cvs-repository/Zope3/src/zope/proxy
In directory cvs.zope.org:/tmp/cvs-serv6159
Modified Files:
__init__.py
Log Message:
Added a convenience function, ProxyIterator for easily inspecting
nested proxies.
=== Zope3/src/zope/proxy/__init__.py 1.6 => 1.7 ===
--- Zope3/src/zope/proxy/__init__.py:1.6 Wed May 28 11:49:11 2003
+++ Zope3/src/zope/proxy/__init__.py Tue Jul 1 19:26:38 2003
@@ -16,6 +16,8 @@
$Id$
"""
+from __future__ import generators
+
from zope.interface import moduleProvides
from zope.proxy.interfaces import IProxyIntrospection
from types import ClassType
@@ -59,3 +61,9 @@
if issubclass(oclass, bclass):
return True
return False
+
+def ProxyIterator(p):
+ yield p
+ while isProxy(p):
+ p = getProxiedObject(p)
+ yield p