[Twisted-Python] can pb.Copyable objects be compared for equality after a round trip?

Micky Latowicki ml.flex at gmail.com
Sat Jun 24 18:13:26 EDT 2006

Only thing I can think of is generate your own id. Doesn't have to be
random, you can simply increament a counter every time you create a new
instance. If you're worried about the id growing too long you can search the
database for unused ids that are lower than the current value of the

Perhaps somebody else has a better idea.

On 24/06/06, Robert Gravina <robert at gravina.com> wrote:
> This is an old thread, but I am finally tackling the round trip
> editing problem and unfortunately getting nowhere. Basically, I want
> to be able to create some object on one machine, then send it off to
> another (who edits some of the attributes) then when the other
> machine calls a method on the original machine and passes it the
> updated object, I can identify it simply by comparing for quality.
> Think of your basic client/server database application.
> The Twisted howtos make the claim that " Copyable objects return
> unchanged from a round trip", and can be compared for quality like
> (obj == obj) but in all my attempts I can get this to work (they are
> never equal). Does someone know of some sample code where this is
> done successfully? It is done successfully with pb.Referenceables in
> the howtos (look for the pb2client.py and pb2server.py listings).
> http://twistedmatrix.com/projects/core/documentation/howto/pb-usage.html
> Since I'm using the ZODB, I've tried using ZODB's _p_oid attribute to
> identify objects that come back to me but the _p_oid is  None even
> after a transaction.commit() (since the object hasn't been persisted
> yet probably).
> I could also create my own ID attribute and attempt to generate a
> random ID and compare that, but this is most definately a hack.
> I am really having trouble progressing with my application because of
> this problem. I'd really appreciate some insight on how to go about
> solving this. Admittedly I'm not all that experienced with Twisted,
> but I thought this kind of thing was supposed to be straightforward.
> What am I doing wrong?
> Thanks,
> Robert
> On 2006/05/07, at 18:55, Micky Latowicki wrote:
> > It's possible to make each element in the set being edited a
> > cacheable. If you think that would introduce too much overhead, then
> > you can add a method to the "address book" object which updates one of
> > the entries in this address book, and uses an id to identify the entry
> > within the address book. So the address book is the dict. That's what
> > I did in a similar case. I'm no expert though.
> >
> > HTH
> >
> > Micky
> > _______________________________________________
> > Twisted-Python mailing list
> > Twisted-Python at twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060625/15f19b64/attachment.htm 

More information about the Twisted-Python mailing list