本文整理匯總了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)
示例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
)
示例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)
示例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)
示例5: __init__
def __init__(self, content):
Reddit.__init__(self, title=_("traffic stats"), content=content)