本文整理汇总了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,
)
示例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)
示例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()
示例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)
示例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)
示例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
)
示例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)
示例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])
示例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)