Created
March 31, 2011 08:33
-
-
Save glassesfactory/896037 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp import util | |
from google.appengine.ext import db | |
import wsgiref.handlers | |
from net.glassesfactory.models import AMFImgData | |
from pyamf.remoting.gateway.wsgi import WSGIGateway | |
class MainHandler(webapp.RequestHandler): | |
def get(self): | |
self.response.out.write('Hello world!') | |
def putImgData(data,name): | |
status ='' | |
try: | |
imgModel = AMFImgData(img_name=name) | |
imgModel.img = db.Blob(str(data)); | |
imgModel.put() | |
status = 'Success' | |
except: | |
status = 'Error' | |
return status | |
def getImgData(name): | |
return AMFImgData.gql('WHERE img_name=:1', name).get() | |
def main(): | |
services = { | |
'putImgData':putImgData, | |
'getImgData':getImgData, | |
} | |
application = WSGIGateway(services) | |
wsgiref.handlers.CGIHandler().run(application) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import db | |
class AMFImgData(db.Model): | |
img_name = db.StringProperty(required=True) | |
img = db.BlobProperty() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment