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