[Twisted-Python] Deserializing AMP callRemoteString without knowing the Command's signature

Laurens Van Houtven _ at lvh.cc
Tue Jun 26 15:09:59 EDT 2012


As some of you may know I am working on a JSON-RPC <-> AMP bridge to
consume AMP services from browsers. WIP: http://lvh.github.com/amphibian/

I've hit a failing integration test. I know what the issue is -- I don't
know how to resolve it.

I attempted to write the proxy without any knowledge of the remote
commands. It assumes that the JSON provided satisfies the remote signature.
If it doesn't -- that's okay, we'll get a failure back from the AMP server.
So, I use callRemoteString and manually serialize by typechecking. Although
that works for sending, the result I get back from callRemoteString is also
in wire format. Because I don't know the signature, I have no idea if the
sender meant 4, "4", u"4"...

dreid pointed out that I really shouldn't need a language-specific
implementation of a class for this to work
teratorn pointed out that there is a JSON schema ticket for AMP. Perhaps
there should also be a "DiscoverSchema" command?

Alternatively I could just cop out and require commands to be importable.
Would make the code simpler but the entire design would become
significantly more coupled.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120626/024fa83a/attachment.htm 

More information about the Twisted-Python mailing list