當前位置: 首頁>>代碼示例>>Python>>正文


Python pages.Reddit類代碼示例

本文整理匯總了Python中r2.lib.pages.pages.Reddit的典型用法代碼示例。如果您正苦於以下問題:Python Reddit類的具體用法?Python Reddit怎麽用?Python Reddit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Reddit類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

    def __init__(self, inner_content, page=None, may_revise=False,
                 actionless=False, alert=None, description=None, 
                 showtitle=False, **context):
        pageactions = []
        if not actionless and page:
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [('edit', _("edit"), True)]
            pageactions += [('revisions/%s' % page, _("history"), False)]
            pageactions += [('discussions', _("talk"), True)]
            if c.is_wiki_mod:
                pageactions += [('settings', _("settings"), True)]

        action = context.get('wikiaction', (page, 'wiki'))
        
        if alert:
            context['infotext'] = alert
        elif c.wikidisabled:
            context['infotext'] = _("this wiki is currently disabled, only mods may interact with this wiki")
        
        self.pageactions = pageactions
        self.page = page
        self.base_url = c.wiki_base_url
        self.action = action
        self.description = description
        
        if showtitle:
            self.pagetitle = action[1]
        else:
            self.pagetitle = None
        
        self.inner_content = inner_content
        
        Reddit.__init__(self, extra_js_config={'wiki_page': page}, 
                        show_wiki_actions=True, **context)
開發者ID:89sos98,項目名稱:reddit,代碼行數:35,代碼來源:wiki.py

示例2: __init__

    def __init__(
        self,
        content,
        page=None,
        may_revise=False,
        actionless=False,
        alert=None,
        description=None,
        showtitle=False,
        **context
    ):
        pageactions = []
        if not actionless and page:
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [("edit", _("edit"), True)]
            pageactions += [("revisions/%s" % page, _("history"), False)]
            pageactions += [("discussions", _("talk"), True)]
            if c.is_wiki_mod and may_revise:
                pageactions += [("settings", _("settings"), True)]

        action = context.get("wikiaction", (page, "wiki"))

        if alert:
            context["infotext"] = alert
        elif c.wikidisabled:
            context["infotext"] = _("this wiki is currently disabled, only mods may interact with this wiki")

        self.pageactions = pageactions
        self.page = page
        self.base_url = c.wiki_base_url
        self.action = action
        self.description = description

        if showtitle:
            self.pagetitle = action[1]
        else:
            self.pagetitle = None

        page_classes = None

        if page and "title" not in context:
            context["title"] = _("%(page)s - %(site)s") % {"site": c.site.name, "page": page}
            page_classes = ["wiki-page-%s" % page.replace("/", "-")]

        Reddit.__init__(
            self,
            extra_js_config={"wiki_page": page},
            show_wiki_actions=True,
            page_classes=page_classes,
            content=content,
            short_title=page,
            **context
        )
開發者ID:SovietMan,項目名稱:reddit,代碼行數:54,代碼來源:wiki.py

示例3: __init__

    def __init__(self, content, actionless=False, alert=None, **context):
        pageactions = []
        
        if not actionless and c.page:
            pageactions += [(c.page, _("view"), False)]
            if this_may_revise(c.page_obj):
                pageactions += [('edit', _("edit"), True)]
            pageactions += [('revisions/%s' % c.page, _("history"), False)]
            pageactions += [('discussions', _("talk"), True)]
            if c.is_wiki_mod:
                pageactions += [('settings', _("settings"), True)]

        action = context.get('wikiaction', (c.page, 'wiki'))
        
        context['title'] = c.site.name
        if alert:
            context['infotext'] = alert
        elif c.wikidisabled:
            context['infotext'] = _("this wiki is currently disabled, only mods may interact with this wiki")
        context['content'] = WikiBasePage(content, action, pageactions, **context)
        Reddit.__init__(self, **context)
開發者ID:Anenome,項目名稱:reddit,代碼行數:21,代碼來源:wiki.py

示例4: __init__

    def __init__(self, content, page=None, may_revise=False, actionless=False, alert=None, **context):
        pageactions = []
        title = c.site.name
        if not actionless and page:
            title = '%s - %s' % (title, page)
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [('edit', _("edit"), True)]
            pageactions += [('revisions/%s' % page, _("history"), False)]
            pageactions += [('discussions', _("talk"), True)]
            if c.is_wiki_mod:
                pageactions += [('settings', _("settings"), True)]

        action = context.get('wikiaction', (page, 'wiki'))
        context['title'] = title
        
        if alert:
            context['infotext'] = alert
        elif c.wikidisabled:
            context['infotext'] = _("this wiki is currently disabled, only mods may interact with this wiki")
        context['content'] = WikiBasePage(content, action, pageactions, page=page, **context)
        Reddit.__init__(self, extra_js_config={'wiki_page': page}, 
                        show_wiki_actions=True, **context)
開發者ID:BenHalberstam,項目名稱:reddit,代碼行數:23,代碼來源:wiki.py

示例5: __init__

 def __init__(self, content):
     Reddit.__init__(self, title=_("traffic stats"), content=content)
開發者ID:AjaxGb,項目名稱:reddit,代碼行數:2,代碼來源:trafficpages.py


注:本文中的r2.lib.pages.pages.Reddit類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。