本文整理汇总了Python中model.po.Po.mc_get方法的典型用法代码示例。如果您正苦于以下问题:Python Po.mc_get方法的具体用法?Python Po.mc_get怎么用?Python Po.mc_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.po.Po
的用法示例。
在下文中一共展示了Po.mc_get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sync_recommend
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def sync_recommend(id, po_id):
from po import Po
p = Po.mc_get(po_id)
s = state_oauth_id_by_zsite_id_cid(id, SYNC_CID_SHARE)
for oauth_id in s:
rec_po = Po.mc_get(p.rid)
if rec_po:
txt = cnencut(p.name_, 20)
if txt:
txt = '%s -> '%txt
else:
txt = txt+"分享: "
sync_by_oauth_id(oauth_id, txt + cnencut(rec_po.name_,50) , 'http:%s'%rec_po.link)
示例2: get
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def get(self, id):
po = Po.mc_get(id)
if po:
link = po.link
else:
link = '/'
self.redirect(link)
示例3: get
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def get(self, id):
po = Po.mc_get(id)
if po:
link = po.link
else:
link = '/'
return self.redirect(link, True)
示例4: get
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def get(self, id):
from model.rss import rss_link_by_po_id
link = rss_link_by_po_id(id)
if not link:
po = Po.mc_get(id)
link = po.link
self.redirect(link, True)
示例5: post
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def post(self, po_id=0):
cid = CID_PHOTO
name = self.get_argument('name', None)
txt = self.get_argument('txt', None)
user_id = self.current_user_id
link = '/feed'
if po_id:
po_id = int(po_id)
po = Po.mc_get(po_id)
if po and po.user_id == user_id:
po.name_ = name
po.txt_set(txt)
po.save()
link = '/po/tag/%s' % po_id
else:
img = self._img()
if img:
zsite_id = zsite_id_by_zsite_user_id(self.zsite, user_id)
if zsite_id:
state = STATE_PO_ZSITE_SHOW_THEN_REVIEW
else:
state = STATE_ACTIVE
po = po_photo_new(user_id, name, txt, img, state, zsite_id)
if po:
po_id = po.id
link = '/po/tag/%s' % po_id
return self.redirect(link)
示例6: post
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def post(self, po_id=0):
cid = CID_VIDEO
url = self.get_argument('video', None)
name = self.get_argument('name', None)
txt = self.get_argument('txt', None)
link = '/feed'
if po_id:
po_id = int(po_id)
po = Po.mc_get(po_id)
if po and po.user_id == self.current_user_id:
po.name_ = name
po.txt_set(txt)
po.save()
link = '/po/tag/%s' % po_id
else:
if url:
video, video_site = video_filter(url)
if video:
user_id = self.current_user_id
zsite_id = zsite_id_by_zsite_user_id(self.zsite, user_id)
if zsite_id:
state = STATE_PO_ZSITE_SHOW_THEN_REVIEW
else:
state = STATE_ACTIVE
po = po_video_new(user_id, name, txt, video, video_site, state, zsite_id)
if po:
po_id = po.id
link = '/po/tag/%s' % po_id
return self.redirect(link)
示例7: post
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def post(self, po_id=0):
cid = CID_AUDIO
name = self.get_argument("name", None)
txt = self.get_argument("txt", None)
link = "/feed"
if po_id:
po_id = int(po_id)
po = Po.mc_get(po_id)
if po and po.user_id == self.current_user_id:
po.name_ = name
po.txt_set(txt)
po.save()
link = "/po/tag/%s" % po_id
else:
audio = self._audio()
if audio:
user_id = self.current_user_id
zsite_id = zsite_id_by_zsite_user_id(self.zsite, user_id)
if zsite_id:
state = STATE_PO_ZSITE_SHOW_THEN_REVIEW
else:
state = STATE_ACTIVE
po = po_audio_new(user_id, name, txt, audio, state, zsite_id=zsite_id)
if po:
po_id = po.id
link = "/po/tag/%s" % po_id
return self.redirect(link)
示例8: po
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def po(self, id):
po = Po.mc_get(id)
if po:
self._po = po
if po.user_id == self.zsite_id:
return po
return self.redirect(po.link)
return self.redirect('/')
示例9: post
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def post(self, id):
current_user_id = self.current_user_id
rec_po = Po.mc_get(id)
if rec_po and rec_po.cid == CID_REC and rec_po.user_id == current_user_id:
name = self.get_argument('txt', '')
rec_po.name_ = name
rec_po.save()
self.finish('{}')
示例10: _sync_site_po
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def _sync_site_po(begin_id):
ss = SiteSync.where('id>%s', begin_id).order_by('id')[0]
if ss:
begin_id = ss.id
zsite = Zsite.mc_get(ZSITE_BIND_FOR_SYNC)
if zsite:
po = Po.mc_get(ss.po_id)
if po:
sync_site_po(po, zsite)
return begin_id
示例11: post
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def post(self, id):
po = Po.mc_get(id)
name = self.get_argument('name', None)
txt = self.get_argument('txt', None)
if name:
po.name_ = name
po.save()
if txt:
po.txt_set(txt)
self.redirect('/event')
示例12: _po
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def _po(self, id):
current_user = self.current_user
current_user_id = self.current_user_id
po = Po.mc_get(id)
if not po:
self.redirect('/')
return
if not po.can_admin(current_user_id):
self.redirect(po.link)
return
return po
示例13: post
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def post(self, id):
po = Po.mc_get(id)
next = self.get_argument("next", "/po")
name = self.get_argument("name", None)
txt = self.get_argument("txt", None)
if name:
po.name_ = name
po.save()
if txt:
po.txt_set(txt)
self.redirect(next)
示例14: rank_update
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def rank_update(po_id):
up = vote_up_count(po_id)
down = vote_down_count(po_id)
po = Po.mc_get(po_id)
_hot = hot(up, down, po.create_time)
_confidence = confidence(up, down)
for r in Rank.where(po_id=po_id):
r.hot = _hot
r.confidence = _confidence
r.save()
mc_flush_cid(r.to_id, r.cid)
示例15: get
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get [as 别名]
def get(self):
id = int(self.get_argument('id'))
user_id = self.current_user_id
r = reply.Reply.mc_get(id)
can_admin = None
if r:
po = Po.mc_get(r.rid)
if po:
can_admin = r.can_admin(user_id) or po.can_admin(user_id)
if can_admin:
r.rm()
self.finish({'status': can_admin})