Exemple #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
Exemple #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
Exemple #3
0
 def getModelNum(self):
     model = GenericCounter()
     return model.get_count('img')
Exemple #4
0
 def getModelNum(self):
     model = GenericCounter()
     return model.get_count("img")