Oleg Broytmann wrote: > On Thu, Jul 30, 2009 at 09:09:25AM -0400, Stef Telford wrote: > >> My hack currently consists of ripping out >> the Decimal stuff mostly from col.py as well as the two line change >> inside psycopg2 .. and that's where I think we may have a problem. The >> Psycopg2 guys are probably -not- interested in changing over from >> Decimal to gmpy, even for speed. Which makes me wonder.. should I >> maintain these patches for myself ? >> >> Let me re-ask that question; is there any point in submitting patches >> to use gmpy to you if to get things working requires a patched psycopg2 >> > > Can the patching be done on the fly (monkey-patching)? Even better - is > there an adapter that can be unregister and reregister to gmpy? This way > you can have a configuration flag for SQLObject that replaces Decimal with > gmpy; SQLObject with this configuration flag reregisters the adaptor for > you. > > Oleg. > Hello again Oleg, So, the specific changes in psycopg2 come down to;
cmp...@test:~/psycopg2-2.0.11$ diff ./psycopg/psycopgmodule.c ../psycopg2-2.0.11-new/psycopg/psycopgmodule.c 595c595 < decimal = PyImport_ImportModule("decimal"); --- > decimal = PyImport_ImportModule("gmpy"); 597c597 < decimalType = PyObject_GetAttrString(decimal, "Decimal"); --- > decimalType = PyObject_GetAttrString(decimal, "mpq"); Kind of a 'no-brainer' there but, since psycopg is a compiled extension, I don't see how we can monkey patch the C lib :( I -can- fling across my kludges off list for col.py and converters.py if you want ? Lastly, I have also hacked my version of SQLObject to disable the local cache, so that SO can use memcache (by subclassing the sqlobject and then making custom get/setattr methods). It would be nice if there was a way to toggle the cache on/off at the SO level (if there is, I haven't found it sadly). Regards Stef ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss