• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python zsite.Zsite类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get

    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',
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:31,代码来源:fav.py


示例2: get

 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)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:9,代码来源:pic.py


示例3: get

    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,
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:57,代码来源:po_view.py


示例4: get

    def get(self, id):
        t = Trade.get(id)
        from_user = Zsite.mc_get(t.from_id)
        to_user = Zsite.mc_get(t.to_id)

        self.render(
            from_user=from_user,
            to_user=to_user,
            trade=t,
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:10,代码来源:money.py


示例5: get

 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)
     )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:14,代码来源:com.py


示例6: get

    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,代码行数:14,代码来源:user_list.py


示例7: get

    def get(self, cid=0, n=1):
        if cid:
            cid = int(cid)
            if cid not in CID_ZSITE_TUPLE:
                return self.redirect('/following')

        zsite_id = self.zsite_id
        if cid:
            id_list = follow_id_list_by_from_id_cid(zsite_id, cid)
        else:
            id_list = follow_id_list_by_from_id(zsite_id)
        total = len(id_list)
        page, limit, offset = page_limit_offset(
            '/following%s-%%s' % (cid or ''),
            total,
            n,
            PAGE_LIMIT
        )
        if type(n) == str and offset >= total:
            return self.redirect('/following%s' % (cid or ''))

        id_list = id_list[offset: offset + limit]
        following = Zsite.mc_get_list(id_list)

        self.render(
            zsite_list=following,
            page=page,
            title='关注',
            path='/following%s'%(cid or '')
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:30,代码来源:follow.py


示例8: get

 def get(self, mail):
     if mail.isdigit():
         user_id = mail
         user = Zsite.mc_get(user_id)
         if user:
             mail = mail_by_user_id(user_id)
             link = mail2link(mail)
             if user:
                 return self.render(mail=mail, link=link)
     elif EMAIL_VALID.match(mail):
         user_id = user_id_by_mail(mail)
         if user_id:
             user = Zsite.mc_get(user_id)
             verify_mail_new(user_id, user.name, mail, self.cid)
             return self.redirect('/auth/password/reset/%s'%user_id)
     self.redirect('/login')
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:16,代码来源:verify.py


示例9: main

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,代码行数:25,代码来源:zhihu_port_name2id.py


示例10: post

    def post(self):
        arguments = parse_qs(self.request.body, True)

        link = ''
        name = ''
        auto = 1

        user_list_exist = []
        for txt, id in zip(arguments.get('txt'), arguments.get('id')):
            user_id = int(id)

            for url in txt.splitlines():
                url = url.strip()
                if url:
                    rss = rss_new(user_id, url, name, link, 0, auto)

            user_list_exist.append(user_id)
 
        if user_list_exist:
            self.render(
                '/god/rss/rss_add.htm',
                user_list_exist=Zsite.mc_get_list(user_list_exist),
                user_list_not_exist=[],
                success = True
            )
        else:
            self.rediect("/rss/add")
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:27,代码来源:rss.py


示例11: _tag_feed_next

def _tag_feed_next(tag_id, offset):
    feed_id = id_by_tag_admin(tag_id, offset)
    #feed_id = 1
    if feed_id:
        feed = FeedImport.get(feed_id)
        author_rm = is_rt_by_title(feed.title)
        tag_id_list = filter(bool, feed.tag_id_list.split(' '))
        tag_id_list = list(
            zip(
                [ i.name for i in Zsite.mc_get_list(tag_id_list) if i is not None],
                tag_id_list
            )
        )

        r = {
            'id':feed.id,
            'title':feed.title,
            'txt':feed.txt,
            'tag_id_list':tag_id_list,
            'author_rm':author_rm,
            'url':feed.url
        }
    else:
        r = '0'
    return r
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:25,代码来源:feed_import.py


示例12: init_channel

def init_channel():
    for id, name in CHANNEL:
        o = Zsite.get_or_create(id=id)
        o.cid = CID_CHANNEL
        o.name = name
        o.state = ZSITE_STATE_ACTIVE
        o.save()
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:7,代码来源:init_db.py


示例13: get

    def get(self, id):
        current_user_id = self.current_user_id

        zsite = Zsite.mc_get(id)

        if zsite:
            follow_new(current_user_id, id)
            mq_buzz_follow_new(current_user_id, id)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:8,代码来源:__init__.py


示例14: _login

 def _login(self, user_id, mail, redirect=None):
     session = user_session(user_id)
     self.set_cookie('S', session)
     self.set_cookie('E', mail)
     if not redirect:
         current_user = Zsite.mc_get(user_id)
         redirect = LOGIN_REDIRECT%current_user.link
     self.redirect(redirect)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:8,代码来源:__init__.py


示例15: buzz_follow_mail

def buzz_follow_mail():
    prev_pos = kv_int.get(KV_BUZZ_FOLLOW_POS)
    c = Buzz.raw_sql(
        'select max(id) from buzz where create_time<%s', int(time()) - ONE_DAY
    )
    pos = c.fetchone()[0]
    if pos > prev_pos:
        d = defaultdict(OrderedDict)

        for i in Buzz.where(cid=CID_BUZZ_FOLLOW).where('to_id=rid').where(
            'id>%s and id<=%s', prev_pos, pos
        ):
            id = i.id
            d[i.to_id][i.from_id] = i.id

        dd = defaultdict(OrderedSet)
        for to_id, _d in d.iteritems():
            if mail_notice_state(to_id, CID_BUZZ_FOLLOW):
                min_id = buzz_pos.get(to_id)
                for from_id, id in _d.iteritems():
                    if id > min_id:
                        dd[to_id].add(from_id)


        for to_id, li in dd.iteritems():

            mail = mail_by_user_id(to_id)
            name = Zsite.mc_get(to_id).name

            for from_id in li:

                from_user = Zsite.mc_get(from_id)
                career = from_user.career
                if from_user.state >= ZSITE_STATE_VERIFY and any(career):
                    rendermail(
                        '/mail/buzz/follow_new.htm', mail, name,
                        from_user=from_user,
                        format='html',
                        subject='%s ( %s ) 关注 你' % (
                            from_user.name,
                            ' , '.join(career),
                        )
                    )
                    #sleep(0.1)

        kv_int.set(KV_BUZZ_FOLLOW_POS, pos)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:46,代码来源:buzz_follow_mail.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python model_base.ModelBase类代码示例发布时间:2022-05-27
下一篇:
Python user.User类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap