Suat Atan PhD
Suat Atan PhD

Reputation: 1382

Google App Engine converting string to property (of Entity)

class Personel(db.Model):
  ismarried=db.StringProperty()


class AddPersonal(webapp.RequestHandler):
  def get(self):
    per=Personal()
    #i want use a function at below, instead of per.ismarried
    per.whatisthisfunction("ismarried")="yes"
    per.put

I want convert string to entity's property. Can it possible as above.

Upvotes: 1

Views: 50

Answers (1)

Rob Wouters
Rob Wouters

Reputation: 16327

What you're looking for is setattr:

setattr(per, "ismarried", "yes")

Upvotes: 3

Related Questions