[Twisted-Python] grokking Cacheable

Sean Riley sean at twistedmatrix.com
Fri Oct 25 11:06:50 EDT 2002


that particular error means that the server class 'mon.net.rop.Cashew' has
no registered copier on the client. You need to call pb.setCopierForClass on
the client like:

from twisted.spread import pb

class YourClientClass(pb.RemoteCache):
    pass

pb.setCopierForClass('mon.net.rop.Cashew', YourClientClass)

and instances of mon.net.rop.Cashew will be transformed into YourClientClass
when they arrive at the client. YourClientClass must be derived from
pb.RemoteCache.

This appears to be one the most common errors when programming with
Cacheables as it occurs not only when you forget to designate a copier, but
when an unexpected server object tried to get sent to the client because of
a reference of assignment you werent aware of. This is a good security
measure :)

-----Original Message-----
From: twisted-python-admin at twistedmatrix.com
[mailto:twisted-python-admin at twistedmatrix.com]On Behalf Of
carball at hush.com
Sent: Friday, October 25, 2002 1:12 AM
To: Twisted-Python at twistedmatrix.com
Subject: [Twisted-Python] grokking Cacheable


attempting to grok Cacheable here. .
was wondering if someone could show a quick example of its correct use?
-----------------------------
attached is what i have so far, just to test. .
i am getting this error when the observer is being serialized?
-----------------------------------------
24/10/2002 09:17 [Broker,0,127.0.0.1] twisted.spread.jelly.InsecureJelly:
Class not allowed for instance: twisted.spread.flavors.RemoteCacheObserver
<RemoteCacheObserver(<twisted.spread.pb.Broker instance at 0x83ab0f4>,
<mon.net.rop.Cashew instance at 0x838b5a4>, <mon_server.rop_myApp.Persp
instance at 0x83834d4>) at 138104980>
-------------------------------
i havent seen any example code in the list, docs, or examples dir
about this dark corner of the pb universe, so i thought i'd ask
------------
any elucidation is quite appreciated
thanks
car





More information about the Twisted-Python mailing list