def insertTag(self,content):
        if content=='':
            self.render('admin/addtag.html',info='')
        elif self.checkTag(content):
            self.render('admin/addtag.html',info='已存在')
        else:
            tag=Tag()
            tag.content=content
            tag.tagid=uuid.uuid1().hex
            self.db.add(tag)
            self.db.commit()
            self.db.close()

            self.render('admin/addtag.html',info='成功')
Exemple #2
0
    def insertTag(self, content):
        if content == '':
            self.render('admin/addtag.html', info='')
        elif self.checkTag(content):
            self.render('admin/addtag.html', info='已存在')
        else:
            tag = Tag()
            tag.content = content
            tag.tagid = uuid.uuid1().hex
            self.db.add(tag)
            self.db.commit()
            self.db.close()

            self.render('admin/addtag.html', info='成功')
    def tagInsert(self, content):
        if self.checkTag(content):
            self.status = 201
            jsonStr = self.getJsonResult()
            self.write(jsonStr)
        else:
            tag = Tag()
            tag.content = content
            tag.tagid = uuid.uuid1().hex
            self.db.add(tag)
            self.db.commit()
            self.db.close()

            self.status = 200
            self.message = "tag添加成功"
            jsonStr = self.getJsonResult()
            self.write(jsonStr)
Exemple #4
0
    def tagInsert(self, content):
        if self.checkTag(content):
            self.status = 201
            jsonStr = self.getJsonResult()
            self.write(jsonStr)
        else:
            tag = Tag()
            tag.content = content
            tag.tagid = uuid.uuid1().hex
            self.db.add(tag)
            self.db.commit()
            self.db.close()

            self.status = 200
            self.message = 'tag添加成功'
            jsonStr = self.getJsonResult()
            self.write(jsonStr)