[Zope3-dev] MessageID as rocks?

Barry Warsaw barry@python.org
16 Apr 2003 15:22:27 -0400


On Wed, 2003-04-16 at 13:29, Shane Hathaway wrote:
> Barry Warsaw wrote:
> > 
> > If that's the case, then we'll need to proxy MessageIDs and we'll need
> > to add all the proxy-aware isinstance machinery, compatible with both
> > Python 2.2 and 2.3.
> > 
> > I'll add that if it doesn't exist already.
> 
> Another option is to come up with a base class that makes things like 
> MessageIDs safe to use as rocks.  Python code could read and write 
> attributes of these objects until something calls the "petrify()" method.
> 
> That's more work than fixing isinstance(), though. :-)

Yeah, fixing isinstance() wasn't too painful. ;)

- In zope/proxy/__init__.py I added a function called
proxy_compatible_isinstance() which (I believe) mimics what Python 2.3's
isinstance() does.

- In zope/tales/tales.py evaluateText(), I call this function and if it
returns true, I do a getbaseobject() and return the results.  This way
the talinterpreter gets the actual MessageID instead of the wrapped
object and then everything from there goes as planned.

Sound right?

It doesn't seem to gross, so I'm happy with checking this in.
-Barry