Here is an example from my own code.
I have an object:
from google.appengine.ext import db
from Owner import Owner
class ImageFile(db.Model):
owner = db.ReferenceProperty(Owner)
caption = db.StringProperty()
description = db.TextProperty()
image = db.BlobProperty()
date = db.DateTimeProperty(auto_now_add=True)
public = db.BooleanProperty()
I have an update method within another class that has this import
from json import JsonReader
The image data gets updated via this post method on the class:
def post(self):
reader = JsonReader()
currentUser = getCurrentUserOwner()
tempImage = reader.read(self.request.body)
if not currentUser is None:
requestedImage = db.get(tempImage['key'])
if requestedImage.owner.key() == currentUser.key():
requestedImage.caption = tempImage['caption']
requestedImage.description = tempImage['description']
requestedImage.public = tempImage['public']
requestedImage.put()
This is from an intro talk I gave on App Engine. If anyone wants the full
source, you can get it at
http://www.scottseely.com/blog/09-05-30/Chicago_Code_Camp_Slides_and_Source.
aspx (it's a short post, link is included!).
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of deostroll
Sent: Monday, June 15, 2009 2:37 AM
To: Google App Engine
Subject: [google-appengine] Re: necessary libs for parsing json?
Now I want to know how to parse?
--deostroll
PS: I've nev done this exercise before. I just don't understand what
next to do after dumps()...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---