AFAIK you could just do this instead of doing an eval and setting the properties using setattr:
m = p_model(**kwargs) where kwargs is the dictionary of properties that you are using to create your model instance. On Mon, Jun 8, 2009 at 2:33 PM, Ethan Post <post.et...@gmail.com> wrote: > I figured this out, so no need to continue using copy. Been a while since I > looked at Python. Sorry if these questions are obvious. Everything is > working like a charm now. > > m = eval(p_model + '()') > > > > On Sun, Jun 7, 2009 at 5:45 PM, Ethan Post <post.et...@gmail.com> wrote: > >> Now that I have the solution to my original problem I am trying to make a >> few improvements. I want to be able to pass a list of dictionaries or a >> single dictionary and multiple records in a single put. The code is working >> but I have a couple issues. One, I pass in p_model but I only use it to >> perform a copy, are there any known issues with using copy on a db.model >> object? Should I use deepcopy instead? >> >> Also, can I use getattr or setattr to instantiate an entity instance in >> Dict_To_Model2 instead of passing in the entity? I can't figure it out. This >> would be the line "m = Foo()". Instead I would just pass in the name as a >> string. I wouldn't need to use copy if I could figure out how to do this. >> >> > > > > -- ======================================= 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ ======================================= --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---