Hello.

On Thu, Jun 22, 2006 at 11:08:34AM +0200, jt wrote:
> I also tried the factory argument of pysqlite connection (could you
> add it to the trunk?):

> +            if 'factory' in kw:
> +                opts['factory'] = popKey(kw, 'factory')(sqlite)

   This supposes that one always create connections by calling the
constructor:

> con = SQLiteConnection('data.db', factory=SQLiteConnectionFactory)

   But many if not most people define the DB URI as a string (from config
file, e.g.). With URI as string it is impossible to define a factory.

   There should be a way to convert a factory name to a callable object.
Something like this:

            if 'factory' in kw:
                factory = popKey(kw, 'factory')
                if isinstance(factory, basestring):
                    factory = globals()[factory]
                if not callable(factory):
                    raise TypeError
                opts['factory'] = factory

from sqlobject.sqlite import sqliteconnection
sqliteconnection.my_connection_factory = MyConnectionFactory

__connection__ = "sqlite:///db?factory=my_connection_factory"

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to