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


Python User.get_ids方法代码示例

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


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

示例1: user_explore

# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import get_ids [as 别名]
def user_explore():
    g.count = 24
    user_ids = User.get_ids(start=g.start, limit=g.count)
    users = [User.get(x) for x in user_ids]
    users = [x for x in users if x.get_profile_item('user_privacy') != consts.USER_PRIVACY_PRIVATE]
    return render_template("user_explore.html",
            users=users, config=config)
开发者ID:icycore,项目名称:thepast,代码行数:9,代码来源:views.py

示例2: home

# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import get_ids [as 别名]
def home():
    user_ids = User.get_ids(limit=10000)

    user = None
    i = 0
    while i <= 3:
        random_uid = random.choice(user_ids)
        user = User.get(random_uid)
        r = check_access_user(user)
        if not r:
            break
        i+=1

    if user:
        history_ids = Status.get_ids(user.id, start=0, limit=20)
        status_list = Status.gets(history_ids)
        status_list  = statuses_timelize(status_list)
        intros = [user.get_thirdparty_profile(x).get("intro") for x in config.OPENID_TYPE_DICT.values()]
        intros = filter(None, intros)
    else:
        status_list = []
        intros = []

    if g.user:
        sync_list = get_sync_list(g.user)
    else:
        sync_list = []

    d = defaultdict(list)
    for x in status_list:
        t = x.create_time.strftime("%Y年%m月%d日")
        d[t].append(x)
    history_status = d

    return render_template("v2/explore.html", **locals())
开发者ID:HengeSense,项目名称:thepast,代码行数:37,代码来源:user_past.py

示例3: generate_docs_file

# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import get_ids [as 别名]
def generate_docs_file(file_):
    from past.model.user import User
    uids = User.get_ids(start=0, limit=400)
    with open(file_, "aw") as f:
        for x in uids:
            print 'get user %s text' % x
            text = get_all_text_by_user(x)
            f.write(text.encode("utf8"))
开发者ID:Ailocodjam,项目名称:thepast,代码行数:10,代码来源:tool_train.py

示例4: execfile

# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import get_ids [as 别名]
# -*- coding:utf-8 -*-

import sys

sys.path.append("../")

import time
import datetime

activate_this = "../env/bin/activate_this.py"
execfile(activate_this, dict(__file__=activate_this))

from past.utils.pdf import generate_pdf, get_pdf_filename, is_pdf_file_exists
from past.model.user import User

if __name__ == "__main__":

    for uid in User.get_ids(0, 10000000):
        try:
            pdf_filename = get_pdf_filename(uid)
            generate_pdf(pdf_filename, uid, 0, 100000, capacity=-1)
            if not is_pdf_file_exists(pdf_filename):
                print "%s generate pdf for user:%s fail" % (datetime.datetime.now(), uid)
            else:
                print "%s generate pdf for user:%s succ" % (datetime.datetime.now(), uid)
        except Exception, e:
            print "%s %s" % (datetime.datetime.now(), e)

        time.sleep(1)
开发者ID:perryhau,项目名称:thepast,代码行数:31,代码来源:generate_pdf.py

示例5: user_explore

# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import get_ids [as 别名]
def user_explore():
    g.count = 24
    user_ids = User.get_ids(start=g.start, limit=g.count)
    users = [User.get(x) for x in user_ids]
    return render_template("user_explore.html", users=users, config=config)
开发者ID:puzzlega,项目名称:thepast,代码行数:7,代码来源:views.py


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