[Zope-Checkins] CVS: Zope3/lib/python/Zope/Proxy - ContextWrapper.py:1.3 IContextWrapper.py:1.3
Steve Alexander
steve@cat-box.net
Sat, 15 Jun 2002 16:38:19 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Proxy
In directory cvs.zope.org:/tmp/cvs-serv22871/lib/python/Zope/Proxy
Modified Files:
ContextWrapper.py IContextWrapper.py
Log Message:
Added a set of convenience functions that you can import from
Zope.App.Traversing.
Fixed a few typos in the ContextWrapper docstrings, and also added
an isWrapper method to Zope/Proxy/IContextWrapper, mainly so that
I can raise nice errors if the convenience functions are passed
an unwrapped object, rather than returning objs or Nones or []s and
having programs fail at tenuously related other places.
=== Zope3/lib/python/Zope/Proxy/ContextWrapper.py 1.2 => 1.3 ===
return getcontext(_ob)
+def isWrapper(_ob):
+ if type(_ob) is Proxy:
+ _ob = getObject(_ob)
+ return type(_ob) in wrapperTypes
class ContainmentIterator:
=== Zope3/lib/python/Zope/Proxy/IContextWrapper.py 1.2 => 1.3 ===
"""Get the object's context, as computed from a context wrapper
"""
+
+ def isWrapper(ob):
+ """Returns truth iff the object is wrapped in a context wrapper
+ """
def ContainmentIterator(ob):
"""Get an iterator for the object's containment chain