On Sep 12, 7:15 pm, badfrog <[EMAIL PROTECTED]> wrote:
> class foo(SQLObject):
> name = StringCol(length=50)
>
> foo(name="Foo1")
>
> foo.get(1).__dict__
> { ..., '_SO_val_name': 'Foo1', ..., 'id': 1, ... }
>
> So... and I know this might be SQLObject-specific, but... is there any
> built-in way to get a dict that would *only* contain {'id' : 1,
> 'name':'Foo1'} in this example?
>
Ah ha! For posterity...
>>> from turbogears.database import so_to_dict
>>> so_to_dict(foo.get(1))
{'name': 'Foo1', 'id': 1}
I love talking to myself :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---