[Twisted-Python] IFoo(x, persist=1)

James Y Knight foom at fuhm.net
Thu Apr 22 17:39:10 MDT 2004


On Apr 22, 2004, at 7:04 PM, Itamar Shtull-Trauring wrote:
> I know this is used a lot (the weakref persistence stuff). Should it be
> option of adaptation or perhaps of adapter registration? Trying to see
> how to fit this in to zope3's, which doesn't do this, and it'd be nice
> to have it as part of their core code rather than ours.

I'm not sure about 'used a lot', looks more like "used a bit". In any 
case, I don't know much about Zope3 interfaces but in PyProtocols you 
could implement a 'persist' functionality by registering a null 
adaptation from the 'original' instance to the 'persisted' adapter 
instance. And that could be controlled by the adapter itself (its 
__init__ could register the new adaptation on 'original') which makes 
more sense) or the caller.

That of course doesn't act exactly the same as it doesn't have the 
weirdo persist=None vs persist=False behavior. Does anyone actually 
depend on that? The current persist argument API is completely bogus so 
I don't think it's a good idea to hack up Zope3's code just for 
backwards compatibility with our broken API.

James





More information about the Twisted-Python mailing list