[Twisted-Python] Transporting pb.Copyable classes?
exarkun at divmod.com
exarkun at divmod.com
Wed Apr 21 12:53:37 MDT 2004
On Wed, 21 Apr 2004 09:57:47 -0700 (PDT), Jasper Phillips <jasper at peak.org> wrote:
>
> [snip]
>
>
> All this seems to me like frantic contortion to avoid a bug in jelly.
> Shouldn't it be able to translate passed class objects into the remote
> version, provided they have been properly registered? Is there some reason
> why not that I am missing?
Indeed. While I would do this differently, jelly should certainly be able to handle your approach. Let's get into specifics, shall we? Here's some code:
>>> from twisted.spread import jelly
>>> class Foo: pass
...
>>> f = Foo()
>>> f.bar = Foo
>>> jelly.jelly(f)
['__main__.Foo', ['dictionary', ['bar', ['class', '__main__.Foo']]]]
So far, so good.
>>> from twisted.spread import pb
>>> class Foo(pb.Copyable):
... pass
...
>>> f = Foo()
>>> f.bar = Foo
>>> jelly.jelly(f)
['__main__.Foo', ['dictionary', ['bar', ['class', '__main__.Foo']]]]
Hmm, that works too. I expected it not to, actually. I suppose something you're doing with globalSecurity or setCopierForClassTree() may be mucking things up.
>
> I appreciate the code suggestions, but basicaly I just want to know whether
> this is expected behavior, or whether I should post a demonstrative test
> case and suggest a fix.
Posting a demonstrative test case would be excellent :) I suspect there is no bug in jelly, just a disagreement in expectations which can easily be resolved once there is a concrete example to talk about.
Jp
More information about the Twisted-Python
mailing list