[Twisted-Python] foolscap copyable and constraint
ciao! i'm playing a bit with foolscap and i try to use RemoteInterface
to describe my constraint but i cannot understand how to use it with
pass-by-copy. this is a small example:
from foolscap import RemoteInterface, registerCopier, \
registerRemoteCopyFactory
class Label:
def __init__(self, text):
self.text = text
def copyLabel(label):
return ('_Label', {'text': label.text})
registerCopier(Label, copyLabel)
def makeLabel(state):
label = Label(state['text'])
return label
registerRemoteCopyFactory('_Label', makeLabel)
class RITest(RemoteInterface):
def getLabel():
return Label
but what i get is:
foolscap.tokens.UnknownSchemaType: can't make constraint from
'__main__.Label' (
participants (2)
-
Brian Warner
-
Marco Giusti