Am 18.11.2011 um 09:30 schrieb Christoph Zwerschke:
> Am 18.11.2011 08:18, schrieb raulna:
>> i need save results in a python object from multiples querys, like:
>>
>> for user in users:
>> phones = DBSession.query(Phone).filter('...
>> <<<< python_object = python_object + phones ?????>>>>>
>>
>> How can i append this results in unique object?
>
> phones = DBSession.query(Phone).filter('...').one()
Here you are getting a single object
> python_object.phones = phones
Here you are setting that single object to an attribute that indicates it's a
colection.
So I think it's not what the OP wants. Either do
python_object.phones.append(phone) # notice the single object
Or set the whole list (which I'm not sure if it's really working, sometimes
collections are nasty)
Diez
--
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.