As fas as I know just

book.title = "New Title"
book.put()

2008/8/31 Aaron <[EMAIL PROTECTED]>:
>
> Given that I have successfully stored a Model defined as:
>
> class Book(db.Model):
>   title = db.StringProperty(required=True)
>   author = db.StringProperty(required=True)
>   illustrator = db.StringProperty(required=True)
>
> In the data store.
>
> I want to send a command to update an attribute of the object.   I
> would like to send over the name of the attribute I want to update and
> it's new value.
>
> I have tried all kinds of things and am unable to dynamically access
> the attribute successfully.  I have tried all kinds of things such as:
>
> attName = 'title'
> book.__getattribute__[attName] = 'Learning Python'
>
> or
>
> attribute = getattr(book, 'author')
> book.attribute = 'Mark Lutz'
>
> or
>
> attribute = getattr(book, 'title')
> book.attribute('Learning Python')
>
> none of these have worked.  I've tried several other options but they
> are even worse than these....
>
> I guess my question boils down to "given a string what is the best way
> to introspect the device to pull out the correct attribute so it can
> be updated dynamically?"
>
> Thanks in advance!
>
> -Aaron O'Brien
> Shawnee, KS
> USA
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to