def get(self): # TODO uncomment to reimport return dir_in = 'img_in/' listing = os.listdir(dir_in) for infile in listing: img = ImageModel() img.data = db.Blob(open(dir_in + "/" + infile).read()) img.put() self.response.out.write("Opened: " + dir_in + "/" + infile + "\n<p>")
def post(self): """ Handles a request to create a new image object Gets the image data from img in the HTTP header/context """ #Create a new object #Fill it with data form the img data from the context #store the object site_image = ImageModel() image_data = self.request.get("img") if (image_data.__len__() > 0): site_image.data = image_data site_image.put() #Re-direct to the page form which the page was created self.redirect('/')