On Dec 27, 2008, at 1:39 PM, Andreas Jung wrote:
> On 27.12.2008 3:06 Uhr, Eric Abrahamsen wrote: >> Sorry for the very beginner question, but I haven't been able to find >> a good discussion of this issue online (possibly because it's too >> basic). >> >> I'm using sqlalchemy as part of a basic web-based CRUD-style CMS. >> I've >> got the Create, Read and Delete parts down, but I'm not sure how best >> to handle the Update part. Because the update page handler functions >> are generic and reused for many different models, all I can be sure >> of >> is having a single object instance, and a dictionary of new values >> with which to update the instances attributes. All I can think of >> doing is >> >> instance.__dict__.update(value_dict) > > for k,v in value_dict.items(). > setattr(instance, k, v) Of course! Thanks a lot for your help. Eric > > > -aj > > > > begin:vcard > fn:Andreas Jung > n:Jung;Andreas > org:ZOPYX Ltd. & Co. KG > adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;; > 72070;Germany > email;internet:i...@zopyx.com > title:CEO > tel;work:+49-7071-793376 > tel;fax:+49-7071-7936840 > tel;home:+49-7071-793257 > x-mozilla-html:FALSE > url:www.zopyx.com > version:2.1 > end:vcard > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---