On Tue, Mar 08, 2011 at 03:56:35PM -0800, Mark McWiggins wrote:
> Is there a way to do this without specifying all the field names? Right now I am just using two fields:
>
> zips = zipcode.select()
>
> for z in zips:
> newz = zipcode(id = z.id, city = z.city, connection = peconnection)
>
> This works, but where there are 14 fields in other tables it's going to be a pain. I couldn't find anything about
> object copy or assignment in the documents, but isn't there a way to do this?
You can convert a row to a dict: z.sqlmeta.asDict() - and pass the
dict back: newz = zipcode(**z.sqlmeta.asDict())
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|