예제 #1
0
파일: views.py 프로젝트: icycore/thepast
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)
예제 #2
0
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())
예제 #3
0
파일: views.py 프로젝트: zhangdjxx/thepast
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)
예제 #4
0
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"))
예제 #5
0
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())
예제 #6
0
# -*- 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)
예제 #7
0
파일: views.py 프로젝트: puzzlega/thepast
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)