コード例 #1
0
def updateTags(tags, article):
    tagList = tags.split(',')
    olds = article.tags
    tagNames = [tag.tagname for tag in olds]
    results = []
    out = []
    for tag in olds:
        if tag.tagname not in tagList:
            out.append(tag)
    for tag in tagList:
        if tag not in tagNames:
            m = TagModel()
            m.publish(tag, article)
            SystemInfoModel.increamentTagCount(tag)
        results.append(tag)
    #
    db.delete(out)
    for tag in out:
        SystemInfoModel.decrementTagCount(tag.tagname)
    return results
コード例 #2
0
 def deleteModel(self):
     SystemInfoModel.decrementTagCount(self.tagname)
     self.delete()