示例#1
0
def save(tag_obj):
    coll = Tag.collection()
    id = coll.save(tag_obj.serialize())
    return id
示例#2
0
def save_tag(tag_name, description=None):
    tag_obj = Tag()
    tag_obj.name = tag_name
    tag_obj.description = description
    tag_obj._id = save(tag_obj)
    return tag_obj
示例#3
0
def get_tag(tag_name):
    coll = Tag.collection()
    dic = coll.find_one({"name": tag_name})
    return Tag.unserialize(dic) if dic is not None else None