本文整理汇总了Python中model.zsite.Zsite.mc_bind方法的典型用法代码示例。如果您正苦于以下问题:Python Zsite.mc_bind方法的具体用法?Python Zsite.mc_bind怎么用?Python Zsite.mc_bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.zsite.Zsite
的用法示例。
在下文中一共展示了Zsite.mc_bind方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import mc_bind [as 别名]
def get(self, n=1):
zsite_id = self.zsite_id
cid = self.cid
page_template = self.page_template
total = fav_po_count_by_user_id_cid(zsite_id, cid)
n = int(n)
page, limit, offset = page_limit_offset(
page_template,
total,
n,
PAGE_LIMIT
)
if n != 1 and offset >= total:
return self.redirect(page_template[:-3])
li = fav_po_list_by_user_id_cid(zsite_id, cid, limit, offset)
if cid == CID_WORD:
rid_po_list = [i for i in li if i.rid]
Po.mc_bind(rid_po_list, 'question', 'rid')
Zsite.mc_bind([i.target for i in rid_po_list], 'user', 'user_id')
self.render(
cid=cid,
total=total,
li=li,
page=page,
back_a='/fav',
)
示例2: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import mc_bind [as 别名]
def get(self, n=1):
zsite_id = self.zsite_id
user_id = self.current_user_id
zsite = self.zsite
zsite_cid = zsite.cid
if zsite_cid == CID_SITE:
self.template = '/ctrl/zsite/po_view/site_po_page.htm'
else:
self.template = '/ctrl/zsite/po_view/po_page.htm'
cid = self.cid
page_template = self.page_template
n = int(n)
if zsite_cid == CID_SITE:
total = po_cid_count_by_zsite_id(zsite_id, cid)
else:
is_self = zsite_id == user_id
total = po_list_count(zsite_id, cid, is_self)
page, limit, offset = page_limit_offset(
page_template,
total,
n,
PAGE_LIMIT
)
if n != 1 and offset >= total:
return self.redirect(page_template[:-3])
if zsite_cid == CID_SITE:
po_list = feed_po_list_by_zsite_id(user_id, zsite_id, cid, limit, offset)
back_a = None
total = 0
else:
po_list = po_view_list(zsite_id, cid, is_self, limit, offset)
if cid == CID_WORD:
rid_po_list = [i for i in po_list if i.rid]
Po.mc_bind(rid_po_list, 'question', 'rid')
Zsite.mc_bind([i.target for i in rid_po_list], 'user', 'user_id')
if is_self:
back_a = '/feed'
else:
back_a = '/'
self.render(
cid=cid,
total=total,
li=po_list,
page=page,
back_a=back_a,
)
示例3: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import mc_bind [as 别名]
def get(self, cid, state, n=1):
path_base = self.request.path.split("-", 1)[0]
total = pic_reviewed_count_by_cid_state(cid, state)
page, limit, offset = page_limit_offset("%s-%%s" % path_base, total, n, PAGE_LIMIT)
if type(n) == str and offset >= total:
return self.redirect(path_base)
pic_list = pic_list_reviewed_by_cid_state(cid, state, limit, offset)
Zsite.mc_bind(pic_list, "user", "user_id")
self.render(cid=int(cid), state=int(state), pic_list=pic_list, total=total, page=page)
示例4: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import mc_bind [as 别名]
def get(self, n=1):
count = product_count()
page, limit, offset = page_limit_offset(
'/product-%s',
count,
n,
PAGE_LIMIT,
)
li = product_list(limit, offset)
Zsite.mc_bind(li, 'zsite', 'zsite_id')
self.render(
li=li,
page=str(page)
)
示例5: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import mc_bind [as 别名]
def get(self, cid, n=1):
cid = int(cid)
qs = Reply.where('cid = %s', cid)
total = qs.count()
page, limit, offset = page_limit_offset(
'/reply_list/%s-%%s'%cid,
total,
n,
PAGE_LIMIT,
)
li = qs.order_by('id desc')[offset: offset + limit]
txt_bind(li)
#print cid == CID_USER
if cid == CID_USER:
Wall.mc_bind(li, 'wall', 'rid')
wall_list = [i.wall for i in li]
Zsite.mc_bind(wall_list, 'from_user', 'from_id')
Zsite.mc_bind(wall_list, 'to_user', 'to_id')
else:
Po.mc_bind(li, 'po', 'rid')
Zsite.mc_bind(li, 'user', 'user_id')
self.render(
reply_list=li,
page=page,
)
示例6: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import mc_bind [as 别名]
def get(self):
user_id = self.current_user_id
li = oauth_access_token_by_user_id(user_id)
OauthClient.mc_bind(li, 'client', 'client_id')
Zsite.mc_bind(li, 'user', 'user_id')
self.render(li=li)