[TransWarp] State of Transwarp
steve at cat-box.net
Wed Jun 12 18:17:01 EDT 2002
Phillip J. Eby wrote:
> Recent work on Zope 3 has evolved the state-of-the-art
> in Python "proxy" objects, and Zope 3 implements security proxies
> already. What I'm curious about is how well non-security-related
> proxies would play in the Zope 3 model, since a lot of Zope code
> requests the removal of proxies in order to inspect objects or to bypass
> security. Obviously, that's not a JAC problem; it's just something I'm
> curious about in the Z3 architecture.
Most of the total unwrapping that goes on in Zope 3 happens to objects
that represent Elements: the "data" or "business" objects of the
One case when they are always unwrapped is before being added to a
There are two kinds of proxies in Zope 3: context wrappers and security
proxies. Jim has a vision of security proxies only being used where
absolutely necessary, so with any luck, there will be a body of trusted
code where you won't see many security proxies.
Context wrappers are used to record the traversal path to an object so
that service lookups can follow that path back. In certain cases, a
context wrapper needs to rebind the "self" of a method call to be the
contextwrapper rather then the original self. This rebinding could be
considered a pointcut operation. It is implemented conditionally on the
type of the attribute descriptor.
Methods that strip off the proxies of an object usually also keep around
the original wrapped object, because they need the services of security
wrappers or context wrappers. The unwrapped object is only used where
we're sure we want an unwrapped object.
I think that a pointcut wrapper would work well enough with Zope 3. The
ContextWrapper implementation is designed to be subclassed, and in fact
has been to provide the method rebinding.
Of course, there are performance considerations for such method
rebinding. I'm pretty certain that TransWarp's fresh classes will
execute faster than subclasses of ContextWrapper implemented in Python.
The C implementation is pretty fast though.
More information about the PEAK