当前位置: 首页>>代码示例>>Python>>正文


Python User.get_instances方法代码示例

本文整理汇总了Python中user.User.get_instances方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_instances方法的具体用法?Python User.get_instances怎么用?Python User.get_instances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.User的用法示例。


在下文中一共展示了User.get_instances方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fun_get_follow_list

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_instances [as 别名]
def fun_get_follow_list(user, page=1, page_cap=16, follow="follow"):
    if follow == "follow":
        tmp_dict = user.follow_user_lib.load_all()
    else:
        tmp_dict = user.follower_user_lib.load_all()
    #print 'tmp_dict ', tmp_dict
    tmp_list = tmp_dict.keys()
    tmp_list.sort()
    
    sum_count = len(tmp_list)
    sum_page = (sum_count % page_cap and sum_count /page_cap + 1) or sum_count / page_cap
    if page > sum_page:
        return ([], 0)
    min_index, max_index = get_index_list_by_page(tmp_list, page=page, page_cap=page_cap)  

    tmp_list_follow = []
    #print 'tmp_list, ', tmp_list[min_index:max_index]
    tmp_con_user = User.get_instances('_id', tmp_list[min_index:max_index])

    for kkk in tmp_con_user:
        tmp_avatar = kkk.avatar
        tmp_list_follow.append({'id':kkk._id, 'thumb':tmp_avatar.thumb_name, 'name':kkk.name})

    #print 'follow list ', tmp_list_follow
    return (tmp_list_follow, sum_count)
开发者ID:deju,项目名称:afw_old,代码行数:27,代码来源:AF_UserTool.py

示例2: fun_user_lib

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_instances [as 别名]
def fun_user_lib(user, page=1, page_cap=16):
    # get all user of the afewords 
    tmp_con = User.get_instances()
    tmp_list = []
    sum_count = 0
    
    #print len(tmp_con), [(kkk._id, kkk.name, kkk.password) for kkk in tmp_con]
    for iii in tmp_con:
        try:
            if str(user._id) != str(iii._id):
                tmp_avatar = iii.avatar
                if iii.password != '' and iii.password is not None:
                    tmp_list.append({'id':iii._id, 'thumb':tmp_avatar.thumb_name, 'name':iii.name})
                    sum_count = sum_count + 1
        except Exception, e:
            continue
开发者ID:deju,项目名称:afw_old,代码行数:18,代码来源:AF_UserTool.py

示例3: fun_get_member_list

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_instances [as 别名]
def fun_get_member_list(group=None, page=1, page_cap=9):
    if type(page) != int:
        logging.error('page must be int type ')
        return [], 0, 1
    
    # get the member list by page 
    member_list = group.member_lib.load_all().keys()
    
    min_index, max_index = get_index_list_by_page(member_list, page=page, page_cap=page_cap)
    
    user_list = member_list[min_index:max_index]
    user_instance_list = User.get_instances('_id', user_list)
    
    res_list = []
    for item in user_instance_list:
        try:
            res_list.append({'user_id': str(item._id), 'user_name': item.name, 
                'user_domain': item.domain, 'user_avatar': item.avatar.thumb_name })
        except Exception, e:
            continue
开发者ID:deju,项目名称:afw_old,代码行数:22,代码来源:AF_GroupTool.py


注:本文中的user.User.get_instances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。