コード例 #1
0
  def get(self, file_id):
    file_id = self.request.get('photoID')
    file = File.get_by_id(long(file_id))

    if not blobstore.get(file.blob):
        self.error(404)
    else:
        self.send_blob(file.blob)
コード例 #2
0
    def get(self, file_id):
        file_id = self.request.get('photoID')
        file = File.get_by_id(long(file_id))

        if not blobstore.get(file.blob):
            self.error(404)
        else:
            self.send_blob(file.blob)
コード例 #3
0
    def post(self):
        fileKeyString = self.request.get('deletePhotoKey')

        #generate message
        file = File.get_by_id(int(fileKeyString))
        message = "Successfully deleted photo: " + file.file_name

        #delete file
        blobstore.delete(file.blob)
        key = file.key
        key.delete()

        self.response.write(message)
コード例 #4
0
    def post(self):
        fileKeyString = self.request.get('deletePhotoKey')

        #generate message
        file = File.get_by_id(int(fileKeyString))
        message = "Successfully deleted photo: " + file.file_name

        #delete file
        blobstore.delete(file.blob)
        key = file.key
        key.delete()

        self.response.write(message)
コード例 #5
0
    def post(self):
        fileKeyString = self.request.get('editPhotoKey')
        newPhotoName = self.request.get('editPhotoName').upper()
        fileToEdit = File.get_by_id(int(fileKeyString))

        #check if another file with that name already exists
        oldFile= File.query(File.file_name==newPhotoName).get()
        if oldFile:
            message = "ERROR: A file with that name already exists"
        else:
            #Find and update the file name of the current file(not possible to do on the actual blob)
            fileToEdit.file_name = newPhotoName
            fileToEdit.put()
            message = "Successfully updated photo name: " + fileToEdit.file_name

        self.response.write(message)
コード例 #6
0
    def post(self):
        fileKeyString = self.request.get('editPhotoKey')
        newPhotoName = self.request.get('editPhotoName').upper()
        fileToEdit = File.get_by_id(int(fileKeyString))

        #check if another file with that name already exists
        oldFile = File.query(File.file_name == newPhotoName).get()
        if oldFile:
            message = "ERROR: A file with that name already exists"
        else:
            #Find and update the file name of the current file(not possible to do on the actual blob)
            fileToEdit.file_name = newPhotoName
            fileToEdit.put()
            message = "Successfully updated photo name: " + fileToEdit.file_name

        self.response.write(message)