예제 #1
0
    def upload(self, img, title):
        #status = ''
        def txn():
            try:
                model = ImgModel()
                model.img = db.Blob(str(img))
                model.title = title
                model.date = datetime.datetime.now()
                model.put()
                return 'Success'
            except:
                return 'Upload Error'

        status = db.run_in_transaction(txn)
        if status != 'UploadError':
            count_model = GenericCounter()
            count_model.increment('img')
        return status
예제 #2
0
    def upload(self, img, title):
        # status = ''
        def txn():
            try:
                model = ImgModel()
                model.img = db.Blob(str(img))
                model.title = title
                model.date = datetime.datetime.now()
                model.put()
                return "Success"
            except:
                return "Upload Error"

        status = db.run_in_transaction(txn)
        if status != "UploadError":
            count_model = GenericCounter()
            count_model.increment("img")
        return status
예제 #3
0
 def getModelNum(self):
     model = GenericCounter()
     return model.get_count('img')
예제 #4
0
 def getModelNum(self):
     model = GenericCounter()
     return model.get_count("img")