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

Robert Gravina robert at gravina.com
Fri May 5 10:42:32 MDT 2006


> As I said, I'm not sure that my way of doing things is the Right Way
> (or considered a best practice), so if anyone can confirm or deny,
> that would possibly be useful. :) It seems like a hack, but it works
> for me.
>

Yeah actually I think my problem is that I shouldn't be using  
Copyable since they copy-by-value and what I really want to do is  
copy-by-reference so that when clients edit attributes on the object  
the server (and other clients) can find out about it. I should be  
using Cacheable, but not sure having every object in my application  
as a Cacheable with a list of observers is the best way to go about it.

Guess I'll just have to think this through a little more.

Although I understand whether to use Referenceable/Copyable/Cachable  
depends on your specific application, If anyone could suggest a good  
general way to approach keeping clients in sync who are sharing many  
objects that would be of great help.

I've already got one "cache" type object (a pb.Cacheable) that keeps  
a list of observers and all adds/updates/deletes go through this...  
but up until now I have been using Copyable for the objects that are  
stored in lists in this cache, but found I can't update after a  
client modifies using Copyables (because I have no way of telling  
which object was sent back to the server). Using Referencable would  
be tricky because the clients need to access all the classes  
attributes to display in the UI, and that would require remote_get*  
methods for all of them) and using Cachables again would require  
*another* list of observers to be maintained - I'm just not sure how  
all this should work.

Does anyone have any suggestions of how to tackle this problem?

Robert





More information about the Twisted-Python mailing list