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


Python Zsite.where方法代码示例

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


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

示例1: get

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
    def get(self, n=1):
        total = Zsite.where().count()
        page, limit, offset = page_limit_offset(
            href='/user_list-%s',
            total=total,
            n=n,
            limit=PAGE_LIMIT
        )
        user_list = Zsite.where(cid=CID_USER).order_by('id desc')[offset:offset+limit]

        self.render(
            user_list=user_list,
            page=page,
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:16,代码来源:user_list.py

示例2: main

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
def main():
    id2alias = {}
    for zhihu_topic in ZHIHU_TOPIC:
        id = zhihu_topic[0]
        alias_list = zhihu_topic[5]
        id2alias[int(id)] = alias_list


    name2id = {}

    for i in Zsite.where(cid=CID_TAG):
        tag_list = map(str.strip, i.name.split("/"))
        zhihu_id = MY2ID[i.id]
        alias_list = id2alias.get(zhihu_id,())

        tag_list.extend(alias_list)
       
        for name in tag_list:
            name2id[name.lower()] = i.id

    print """
#coding:utf-8

NAME2ID = """,
    pprint(name2id)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:27,代码来源:zhihu_port_name2id.py

示例3: check

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
def check():
    for z in Zsite.where():
        um = UserMail.get(user_id=z.id)
        print z.id
        if um:
            if z.state <= ZSITE_STATE_APPLY:
                um.state = MAIL_UNVERIFY
                um.save()
            else:
                um.state = MAIL_LOGIN
                um.save()
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:13,代码来源:user_mail_change_state.py

示例4: rm_same

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
def rm_same():
    sites = []
    result = {}
    for site in Zsite.where(cid=3, state=40):
        if site.name in result:
            sites.append([site.id, site.name])
        else:
            result[site.name] = site.id
    print len(sites)

    for i, j in sites:
        zsite_site_rm(i)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:14,代码来源:add_sites.py

示例5: recover

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
def recover():
    rec = []
    for z in Zsite.where(cid=3, state=0):
        if Rss.get(user_id=z.id):
            rec.append(z)

    #  print rec
    rec_name = [i.name for i in rec]
    # print rec_name

    rm = []
    for z in Zsite.where(cid=3, state=40):
        if z.name in rec_name:
            rm.append(z)

    for z in rec:
        z.state = 40
        zsite_admin_new(z.id, 10017321)
        z.save()
        zsite_show_new(z.id, 3)

    for z in rm:
        zsite_site_rm(z.id)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:25,代码来源:add_sites.py

示例6: get

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
 def get(self, n=1):
     qs = Zsite.where(cid=CID_COM)
     total = qs.count()
     page, limit, offset = page_limit_offset(
             '/com-%s',
             total,
             n,
             PAGE_LIMIT,
             )
     li = qs.order_by('id desc')[offset: offset+limit]
     self.render(
             li=li,
             page=page
             )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:16,代码来源:com.py

示例7: main

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
def main():
    for i in Zsite.where().col_list():
        man = Man.get(i)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:5,代码来源:zsite_txt.py

示例8: pprint

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
#    url2id = {}
#    for i in ZHIHU_TOPIC:
#        url = i[2] or i[1]
#        id = i[0]
#        rank = i[-1]
#
#        if id in ID2MY:
#            url2id[ID2MY[id] ] = rank 
#
#
#    from zkit.pprint import pprint
#
#    pprint(url2id)
#"""
RESULT = {}
for tag in Zsite.where(cid=CID_TAG):
    name_list = map(str.strip, tag.name.split('/'))
    for name in name_list:
        RESULT[name.replace('·', '.').lower()] = tag.id

for i in ZHIHU_TOPIC:
    id = i[0]
    if id not in ID2MY:
        continue
    rename = i[-1]
    for name in rename:
        name = name.lower()
        if name in RESULT and RESULT[name] != ID2MY[id]:
            zsite = Zsite.mc_get(ID2MY[id])
            print zsite.id, zsite.name
            zsite = Zsite.mc_get(RESULT[name])
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:33,代码来源:name2id.py

示例9: main

# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import where [as 别名]
def main():
    for i in Zsite.where().col_list():
        rank = zsite_rank_by_zsite_id(i)
        zsite_rank_update_by_zsite_id(i, rank)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:6,代码来源:rank.py


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