Try http://docs.python.org/library/functions.html#setattr
On Jun 6, 7:56 am, Ethan Post <post.et...@gmail.com> wrote: > I want a method which takes a model object and a dictionary and adds a new > record to the model using the the dictionary. The problem is I don't know > how to refer to model.property using a variable. model(property) does not > work. > > MyTable (db.model): > location ... > > def Foo (p_model, p_dict): > for i in p_dict: > # Here is the tricky part, this does not work but you get the idea. > p_model(i) = p_dict[i] > > p_model.put() > > def CallFoo: > m = MyTable() > d = {"key_name":"some_key_123", > "location":"someplace"} > Foo(m, d) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---