[Twisted-Python] Query output from pyPgSQL via Perspective Broker, how?

This is a pyPgSQL-Twisted mixed question, I post it here because I recently saw Gerard Haering posting, hi Gerard. :-) I'm trying to remotely send the PostgreSQL query output from pyPgSQL via Perspective Broker, and finding it difficult to prevent all the InsecureJelly exceptions. I'm trying to avoid modifying hundreds of already written queries, and I'm patching pyPgSQL instead (albeit at runtime). A first problem is that the make_PgResultSetClass factory function dinamically builds a subclass of the PgResultSet class, making it impossible to statically subclass it with pb.Copyable and pb.RemoteCopy . I worked around that making the make_PgResultSetClass return an object of the PgResultSet class, instead of a new subclass. This seems to work. Now I'm fighting against all the pyPgSQL special types. I'm changing the typecast method in the TypeCache class to return only standard types, and while it works fine for number and strings, it seems that mx.DateTime and PG_INET values are not intercepted. I convert the mx.DateTime and mx.DateTimeDelta instances into standard datetime and timedelta ones, since the Twisted docs says PB already knows those. I also added a check for PG_INET, returning str(value) in that case. I'm still getting InsecureJelly exceptions for these two data types, though. I feel like I'm following the tough road doing this, maube there's a simpler way of achieving what I need. Any suggestions? Thanks in advance. [P.S.: the .sig was not manually chosen, just happened. ;-) ] -- Nicola Larosa - nico@tekNico.net With Twisted, you don't need threads. You don't want threads. Threads are actually harmful: http://www.kuro5hin.org/story/2002/11/18/22112/860 -- Jonathan Lange, August 2004

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [Sorry for the self-reply, have to clarify a couple of things.]
I worked around that making the make_PgResultSetClass return an object of the PgResultSet class, instead of a new subclass. This seems to work.
That would be "...making the make_PgResultSetClass return an *instance* of the PgResultSet class, ...". I don't want to set fetchReturnsList to True, because I need column names in the query output. I could also add an OrderedDict type, and return an instance of that from the __fetchOneRow method of the Cursor class, instead of a PgResultSet. I would still have the problem with the pyPgSQL types, though. - -- Nicola Larosa - nico@tekNico.net With Twisted, you don't need threads. You don't want threads. Threads are actually harmful: http://www.kuro5hin.org/story/2002/11/18/22112/860 -- Jonathan Lange, August 2004 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBdiPpXv0hgDImBm4RAkoWAKC7qlksE+tX+fdwAZNnRDZqBuuYFgCggkMv vYMrvNUy3WXF5qtMiHf6l0I= =7SPp -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [Sorry for the self-reply, have to clarify a couple of things.]
I worked around that making the make_PgResultSetClass return an object of the PgResultSet class, instead of a new subclass. This seems to work.
That would be "...making the make_PgResultSetClass return an *instance* of the PgResultSet class, ...". I don't want to set fetchReturnsList to True, because I need column names in the query output. I could also add an OrderedDict type, and return an instance of that from the __fetchOneRow method of the Cursor class, instead of a PgResultSet. I would still have the problem with the pyPgSQL types, though. - -- Nicola Larosa - nico@tekNico.net With Twisted, you don't need threads. You don't want threads. Threads are actually harmful: http://www.kuro5hin.org/story/2002/11/18/22112/860 -- Jonathan Lange, August 2004 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBdiPpXv0hgDImBm4RAkoWAKC7qlksE+tX+fdwAZNnRDZqBuuYFgCggkMv vYMrvNUy3WXF5qtMiHf6l0I= =7SPp -----END PGP SIGNATURE-----
participants (1)
-
Nicola Larosa