Hi,

I'm currently rewriting a thrift server code in python to use twisted
instead of the default server implementations (TThreadedServer or
TThreadPoolServer).

But i also have several client code in python that i don't want to
switch to twisted, because using the default thrift client code is
easier to deal with (also: i have users that just write clients, and i
don't want to impose them to learn twisted to use the server).

I thought that just replacing TBufferedTransport by TFramedTransport in
python client code would be sufficient, but actually, generating the
client service with "thrift-gen py:twisted" changes more than that: now
the service constructor takes two parameters instead of one.

I tried to generate both the default service and the twisted one in
separate directories: ./gen-py and ./gen-py-twisted, and have my server
import from ./gen-py-twisted and the clients import from ./gen-py, but
it's not a working solution since i also have service modules, both
imported from the client and the server, that perform conversions
between thrift structures and application specific structures. This
modules need to import either from ./gen-py-twisted or ./gen-py, but in
any case, at some point, this results in an incoherence in the imports
(eg: the client imports ./gen-py and imports the service module which
itself imports from ./gen-py-twisted)

I wonder what could be the best way to solve this problem?

By the way, thanks all the thrift team for the great software, and
Esteve for the twisted stuff.

cheers,

-- 
Matthieu

Reply via email to