[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-13 Thread Michael Bayer
that approach fails to take into account arguments consumed from **kwargs by superclasses. the particular method I have makes some assumptions about the construction of the class being inspected, i.e. that it looks like this: class Foo(object): def __init__(self, arg1, arg2): ... cla

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-13 Thread Philip Jenvey
On Nov 12, 2006, at 11:56 AM, Michael Bayer wrote: > > since create_engine deals with class constructors, i went with this > approach: > > def get_cls_kwargs(cls): > """return the full set of legal kwargs for the given cls""" > kw = [] > for c in cls.__mro__: > cons = c.__ini

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-13 Thread Shannon -jj Behrens
On 11/12/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > since create_engine deals with class constructors, i went with this > approach: > > def get_cls_kwargs(cls): > """return the full set of legal kwargs for the given cls""" > kw = [] > for c in cls.__mro__: > cons = c.__init

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-12 Thread Michael Bayer
since create_engine deals with class constructors, i went with this approach: def get_cls_kwargs(cls): """return the full set of legal kwargs for the given cls""" kw = [] for c in cls.__mro__: cons = c.__init__ if hasattr(cons, 'func_code'): for vn in cons.

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Michael Bayer
ugh, well i fixed that one. random doc bugs you can file tickets for, or ill just give you commit access if you want to knock some out yourself. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" gr

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Shannon -jj Behrens
On 11/7/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > yeah, or use introspection to consume the args, i thought of that too. > i guess we can do that. of course i dont like having to go there but i > guess not a big deal. > > as far as kwargs collisions, yeah, thats a potential issue too. but >

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Shannon -jj Behrens
On 11/7/06, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote: > The following results in correct data going into and coming out of the > database, but the data in the database itself looks double encoded: > > import MySQLdb > > > connection = MySQLdb.connect(host="fmapp03", user="foxmarks", >

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Michael Bayer
yeah, or use introspection to consume the args, i thought of that too. i guess we can do that. of course i dont like having to go there but i guess not a big deal. as far as kwargs collisions, yeah, thats a potential issue too. but the number of dialects/pools is not *that* varied, theyre gener

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Shannon -jj Behrens
The following results in correct data going into and coming out of the database, but the data in the database itself looks double encoded: import MySQLdb connection = MySQLdb.connect(host="fmapp03", user="foxmarks", passwd='ChunkyBacon', db="users") cursor = connect

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Shannon -jj Behrens
On 11/4/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > > Shannon - > > im trying to figure a way to make create_engine() behave the way you > want. but let me show you a highly simplified version of how > create_engine() works. how would you change it ? > > def create_engine(url, **kwargs): >

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-07 Thread Shannon -jj Behrens
On 11/4/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > Shannon -jj Behrens wrote: > > I'm using convert_unicode=True. Everything is fine as long as I'm the > > one reading and writing the data. However, if I look at what's > > actually being stored in the database, it's like the data has been >

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-04 Thread Michael Bayer
Shannon - im trying to figure a way to make create_engine() behave the way you want. but let me show you a highly simplified version of how create_engine() works. how would you change it ? def create_engine(url, **kwargs): pool = pool.Pool(**kwargs) dialect = module.Dialect(url, **kwar

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-04 Thread Michael Bayer
Shannon -jj Behrens wrote: > Changing from convert_unicode=True to use_unicode=True doesn't do what > you'd expect. SQLAlchemy is passing keyword arguments all over the > place, and use_unicode actually gets ignored. I > personally think that you should be strict *somewhere* when you're > passi

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-04 Thread Michael Bayer
Shannon -jj Behrens wrote: > I'm using convert_unicode=True. Everything is fine as long as I'm the > one reading and writing the data. However, if I look at what's > actually being stored in the database, it's like the data has been > encoded twiced. If I switch to use_unicode=True, which I be

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-04 Thread Andrija Zarić
Logic is just fine... I guess you forgot to consider first param "not dialect.convert_unicode". On the sidenote, the doc string (http://www.sqlalchemy.org/docs/docstrings.myt#docstrings_sqlalchemy.engine) says that: convert_unicode=False : True if unicode conversion should be applied to all str

[sqlalchemy] Re: convert_unicode=True results in double encoding

2006-11-03 Thread Shannon -jj Behrens
On 11/3/06, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote: > I'm using convert_unicode=True. Everything is fine as long as I'm the > one reading and writing the data. However, if I look at what's > actually being stored in the database, it's like the data has been > encoded twiced. If I switch