sorry.. in the beginning line i meant,

I have this code, but the returning "syms" doesn't work for
TurboGear's jsonify. Returning "newSyms" works

thanks.

On Mar 18, 6:10 pm, "tml" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have this code, but the returning "objB" doesn't work for
> TurboGear's jsonify. Returning "objB" works
>
> chem_data = Table('chem_data', metadata,
>     Column('id', Integer, primary_key=True),
>     Column('symbol', String(8), nullable=False, index=True),
>     Column('name', Unicode(64), nullable=False, index=True),
>     Column('location', Unicode(32)),
>     Column('description', Unicode),
>     mysql_engine='InnoDB'
> )
>
> def searchData(filter, limit=10):
>         cols = [chem_data.c.name, chem_data.c.symbol]
>         symList = select(cols, or_(chem_data.c.symbol.like(filter),
>                      chem_data.c.name.like(filter)), limit=limit).execute()
>         if symList.rowcount:
>                 syms = symList.fetchall()
>                 print "XXXXX", syms, type(syms)
>                 newSyms = [(t.name, t.symbol) for t in syms]
>                 print "YYYYY", newSyms, type(newSyms)
>                 return newSyms # This works
>                 return syms # This wont work.
>         else:
>                 return []
>
> The print returns:
> XXXXX [(u'Oxygen', 'O')] <type 'list'>
> YYYYY  [(u'Oxygen', 'O')] <type 'list'>
>
> Does fetchall() return some kind of weird list? or might be a bug in
> SA...
>
> thanks.
>
> -tml


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to