On Tuesday 27 November 2007, Oleg Broytmann wrote:
> On Tue, Nov 27, 2007 at 09:34:31PM +0200, Dan Pascu wrote:
> > I think the extra if using_sqlite2 test you added is not necessary.
> > There is already such a test a bit below that could accommodate the 2
> > lines:
> >
> > sqlite.encode = base64.encodestring
> > sqlite.decode = base64.decodestring
> >
> > In fact the original try/except you have removed was inside that
> > if using_sqlite2: block, and it would have been enough to replace
> > that try/except block with these 2 lines.
>
>    I'd like to set this only once, so I initialize it just after
> import, inside
>
>    if sqlite is None:
>       ...
>
>    But using_sqlite2 could be False here because of the absence of
> sqlite3 or pysqlite2.

Ok, makes sense not to set it everytime a new connection object is 
created. But then how about the other things that get set below in the 
if using_sqlite2 block that starts at line 51 in sqliteconnection.py (in 
the trunk version):

for col_type 
in "text", "char", "varchar", "date", "time", "datetime", "timestamp":
    sqlite.register_converter(col_type, stop_pysqlite2_converting_strings)
    sqlite.register_converter(col_type.upper(), 
stop_pysqlite2_converting_strings)
global sqlite2_Binary
if sqlite2_Binary is None:
    sqlite2_Binary = sqlite.Binary
    sqlite.Binary = lambda s: sqlite2_Binary(sqlite.encode(s))

Shouldn't these also only be done once after the module import?

-- 
Dan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to