本文整理汇总了Python中turbojson.jsonify.jsonify_sqlobject函数的典型用法代码示例。如果您正苦于以下问题:Python jsonify_sqlobject函数的具体用法?Python jsonify_sqlobject怎么用?Python jsonify_sqlobject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jsonify_sqlobject函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jsonify_user
def jsonify_user(obj):
"""Convert user to JSON."""
result = jsonify_sqlobject(obj)
del result['password']
result["groups"] = [g.group_name for g in obj.groups]
result["permissions"] = [p.permission_name for p in obj.permissions]
return result
示例2: jsonify_user
def jsonify_user(obj):
result = jsonify_sqlobject(obj)
try: del result['password']
except KeyError: pass
result["groups"] = [g.group_name for g in obj.groups]
result["permissions"] = [p.permission_name for p in obj.permissions]
return result
示例3: jsonify_permission
def jsonify_permission(obj):
result = jsonify_sqlobject(obj)
result["groups"] = [g.group_name for g in obj.groups]
return result
示例4: jsonify_user
def jsonify_user(obj):
result = jsonify_sqlobject(obj)
del result["password"]
result["groups"] = [g.group_name for g in obj.groups]
result["permissions"] = [p.permission_name for p in obj.permissions]
return result
示例5: jsonify_group
def jsonify_group(obj):
result = jsonify_sqlobject(obj)
result["users"] = [u.user_name for u in obj.users]
result["permissions"] = [p.permission_name for p in obj.permissions]
return result
示例6: jsonify_permission
def jsonify_permission(obj):
"""Convert permissions to JSON."""
result = jsonify_sqlobject(obj)
result["groups"] = [g.group_name for g in obj.groups]
return result
示例7: jsonify_listitem
def jsonify_listitem(obj):
return jsonify_sqlobject(obj.child)
示例8: jsonify_item
def jsonify_item(obj):
result = jsonify_sqlobject(obj)
result["children"] = [jsonify_item(li.child) for li in obj.children]
return result
示例9: jsonify_user
def jsonify_user(obj):
result = jsonify_sqlobject(obj)
result.pop('password', None)
result['groups'] = [g.group_name for g in obj.groups]
result['permissions'] = [p.permission_name for p in obj.permissions]
return result