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


Python SyncTask.gets_by_user方法代码示例

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


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

示例1: _add_sync_task_and_push_queue

# 需要导入模块: from past.model.status import SyncTask [as 别名]
# 或者: from past.model.status.SyncTask import gets_by_user [as 别名]
def _add_sync_task_and_push_queue(provider, user):
        
    task_ids = [x.category for x in SyncTask.gets_by_user(user)]

    if provider == config.OPENID_DOUBAN:
        if str(config.CATE_DOUBAN_STATUS) not in task_ids:
            t = SyncTask.add(config.CATE_DOUBAN_STATUS, user.id)
            t and TaskQueue.add(t.id, t.kind)

    elif provider == config.OPENID_SINA:
        if str(config.CATE_SINA_STATUS) not in task_ids:
            t = SyncTask.add(config.CATE_SINA_STATUS, user.id)
            t and TaskQueue.add(t.id, t.kind)
    elif provider == config.OPENID_TWITTER:
        if str(config.CATE_TWITTER_STATUS) not in task_ids:
            t = SyncTask.add(config.CATE_TWITTER_STATUS, user.id)
            t and TaskQueue.add(t.id, t.kind)
    elif provider == config.OPENID_QQ:
        if str(config.CATE_QQWEIBO_STATUS) not in task_ids:
            t = SyncTask.add(config.CATE_QQWEIBO_STATUS, user.id)
            t and TaskQueue.add(t.id, t.kind)
    elif provider == config.OPENID_RENREN:
        for cate in (config.CATE_RENREN_STATUS, config.CATE_RENREN_BLOG, 
                config.CATE_RENREN_ALBUM, config.CATE_RENREN_PHOTO):
            if str(cate) not in task_ids:
                t = SyncTask.add(cate, user.id)
                t and TaskQueue.add(t.id, t.kind)
    elif provider == config.OPENID_INSTAGRAM:
        if str(config.CATE_INSTAGRAM_STATUS) not in task_ids:
            t = SyncTask.add(config.CATE_INSTAGRAM_STATUS, user.id)
            t and TaskQueue.add(t.id, t.kind)
开发者ID:loosky,项目名称:thepast,代码行数:33,代码来源:view.py

示例2: profile

# 需要导入模块: from past.model.status import SyncTask [as 别名]
# 或者: from past.model.status.SyncTask import gets_by_user [as 别名]
def profile():
    u = g.user
    sync_tasks = SyncTask.gets_by_user(u)
    my_sync_cates = [x.category for x in sync_tasks]
    site_homepage_list = []
    for ua in g.user_alias:
        if ua.type == config.OPENID_TYPE_DICT[config.OPENID_DOUBAN]:
            site_homepage_list.append({'site':u'豆瓣', 'homepage':'http://www.douban.com/people/%s' %ua.alias})
        elif ua.type == config.OPENID_TYPE_DICT[config.OPENID_SINA]:
            site_homepage_list.append({'site':u'新浪微博', 'homepage':'http://www.weibo.com/%s' %ua.alias})
        elif ua.type == config.OPENID_TYPE_DICT[config.OPENID_TWITTER]:
            site_homepage_list.append({'site':u'twitter', 'homepage':'http://www.twitter.com/%s' %ua.alias})
    return render_template("profile.html", user=u, 
            my_sync_cates = my_sync_cates, site_homepage_list=site_homepage_list, config=config)
开发者ID:cnpopeye,项目名称:thepast,代码行数:16,代码来源:views.py

示例3: _add_sync_task_and_push_queue

# 需要导入模块: from past.model.status import SyncTask [as 别名]
# 或者: from past.model.status.SyncTask import gets_by_user [as 别名]
def _add_sync_task_and_push_queue(provider, user):
        
        task_ids = [x.category for x in SyncTask.gets_by_user(user)]

        if provider == config.OPENID_DOUBAN:
            if str(config.CATE_DOUBAN_MINIBLOG) not in task_ids:
                t = SyncTask.add(config.CATE_DOUBAN_MINIBLOG, user.id)
                t and TaskQueue.add(t.id, t.kind)
            if str(config.CATE_DOUBAN_NOTE) not in task_ids:
                t = SyncTask.add(config.CATE_DOUBAN_NOTE, user.id)
                t and TaskQueue.add(t.id, t.kind)

        elif provider == config.OPENID_SINA:
            if str(config.CATE_SINA_STATUS) not in task_ids:
                t = SyncTask.add(config.CATE_SINA_STATUS, user.id)
                t and TaskQueue.add(t.id, t.kind)
        elif provider == config.OPENID_TWITTER:
            if str(config.CATE_TWITTER_STATUS) not in task_ids:
                t = SyncTask.add(config.CATE_TWITTER_STATUS, user.id)
                t and TaskQueue.add(t.id, t.kind)
开发者ID:perryhau,项目名称:thepast,代码行数:22,代码来源:views.py

示例4: profile

# 需要导入模块: from past.model.status import SyncTask [as 别名]
# 或者: from past.model.status.SyncTask import gets_by_user [as 别名]
def profile():
    u = g.user
    sync_tasks = SyncTask.gets_by_user(u)
    my_sync_cates = [x.category for x in sync_tasks]
    return render_template("profile.html", user=u, my_sync_cates=my_sync_cates, config=config)
开发者ID:kadefor,项目名称:thepast,代码行数:7,代码来源:views.py

示例5: exit

# 需要导入模块: from past.model.status import SyncTask [as 别名]
# 或者: from past.model.status.SyncTask import gets_by_user [as 别名]
import datetime
from past import config
from past.model.status import SyncTask
from past.model.user import User
import jobs

if __name__ == '__main__':
    user = User.get(sys.argv[1])
    old = sys.argv[2] == "old"

    if not user:
        print "no such user"
        exit(1)

    ts = SyncTask.gets_by_user(user)
    if not ts:
        print "no sync tasks"

    for t in ts:
        try:
            if t.category == config.CATE_WORDPRESS_POST:
                jobs.sync_wordpress(t)
            else:
                jobs.sync(t, old=old)
        except Exception, e:
            import traceback
            print "%s %s" % (datetime.datetime.now(), traceback.format_exc())

        
开发者ID:EdwinHi,项目名称:thepast,代码行数:29,代码来源:manully_sync_user_timeline.py


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