[Twisted-Python] Controlling the classes being Jellied

Patrik Blommaskog pb_twisted at olga.mine.nu
Tue Jul 1 07:58:34 MDT 2003


I'm using PB and want to accomplish something like this:

On the server, I have the following class hierarchy:

    Actor(pb.Copyable)
  
    GoodActor(Actor)
    BadActor(Actor)
    ...
    WhateverActor(Actor)

There exists a number of instances of each of these classes.

When Jellying them over to the client, I want each of them to create 
instances of the client class RemoteActor, no matter which of the server 
classes they are of. In practice, the different server classes will 
generate different state data that is transmitted to the client, where 
that state data just updates __dict__ , at least for now.

There are two things I would need input on how to accomplish:

1. I don't want to put the code for any of the server classes on the 
client just for the unjellying mapping, as they do in the PB examples. I 
think I am looking for a way to associate a class name, rather than the 
class itself, with a client-side class. E.g. { "Actor" : RemoteActor } 
instead of { Actor : RemoteActor ].

2. I would like all server classes derived from Actor be identified as 
being of class Actor when Jellied. The client should not need to know 
about any server-side child classes at all. They may not even exist at 
the time when the client is distributed.

I'd appreciate any pointers on how to do this, and also any hints if I 
seem to be thinking in the wrong direction.


- Patrik





More information about the Twisted-Python mailing list