def save(tag_obj): coll = Tag.collection() id = coll.save(tag_obj.serialize()) return id
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
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