当前位置: 首页>>代码示例>>Python>>正文


Python Subreddit.get_promote_srid方法代码示例

本文整理汇总了Python中r2.models.Subreddit.get_promote_srid方法的典型用法代码示例。如果您正苦于以下问题:Python Subreddit.get_promote_srid方法的具体用法?Python Subreddit.get_promote_srid怎么用?Python Subreddit.get_promote_srid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在r2.models.Subreddit的用法示例。


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

示例1: new_promotion

# 需要导入模块: from r2.models import Subreddit [as 别名]
# 或者: from r2.models.Subreddit import get_promote_srid [as 别名]
def new_promotion(title, url, selftext, user, ip):
    """
    Creates a new promotion with the provided title, etc, and sets it
    status to be 'unpaid'.
    """
    sr = Subreddit._byID(Subreddit.get_promote_srid())
    l = Link._submit(title, url, user, sr, ip)
    l.promoted = True
    l.disable_comments = False
    l.sendreplies = True
    PromotionLog.add(l, 'promotion created')

    if url == 'self':
        l.url = l.make_permalink_slow()
        l.is_self = True
        l.selftext = selftext

    l._commit()

    update_promote_status(l, PROMOTE_STATUS.unpaid)

    # the user has posted a promotion, so enable the promote menu unless
    # they have already opted out
    if user.pref_show_promote is not False:
        user.pref_show_promote = True
        user._commit()

    # notify of new promo
    emailer.new_promo(l)
    return l
开发者ID:APerson241,项目名称:reddit,代码行数:32,代码来源:promote.py

示例2: new_promotion

# 需要导入模块: from r2.models import Subreddit [as 别名]
# 或者: from r2.models.Subreddit import get_promote_srid [as 别名]
def new_promotion(is_self, title, content, author, ip):
    """
    Creates a new promotion with the provided title, etc, and sets it
    status to be 'unpaid'.
    """
    sr = Subreddit._byID(Subreddit.get_promote_srid())
    l = Link._submit(
        is_self=is_self,
        title=title,
        content=content,
        author=author,
        sr=sr,
        ip=ip,
    )

    l.promoted = True
    l.disable_comments = False
    l.sendreplies = True
    PromotionLog.add(l, 'promotion created')

    update_promote_status(l, PROMOTE_STATUS.unpaid)

    # the user has posted a promotion, so enable the promote menu unless
    # they have already opted out
    if author.pref_show_promote is not False:
        author.pref_show_promote = True
        author._commit()

    # notify of new promo
    emailer.new_promo(l)
    return l
开发者ID:pra85,项目名称:reddit,代码行数:33,代码来源:promote.py

示例3: query

# 需要导入模块: from r2.models import Subreddit [as 别名]
# 或者: from r2.models.Subreddit import get_promote_srid [as 别名]
 def query(self):
     if self.sort == "future_promos":
         return queries.get_all_unapproved_links()
     elif self.sort == "pending_promos":
         return queries.get_all_accepted_links()
     elif self.sort == "unpaid_promos":
         return queries.get_all_unpaid_links()
     elif self.sort == "rejected_promos":
         return queries.get_all_rejected_links()
     elif self.sort == "live_promos" and self.sr:
         return self.live_by_subreddit(self.sr)
     elif self.sort == 'live_promos':
         return queries.get_all_live_links()
     elif self.sort == 'underdelivered':
         q = queries.get_underdelivered_campaigns()
         campaigns = PromoCampaign._by_fullname(list(q), data=True,
                                                return_dict=False)
         link_ids = [camp.link_id for camp in campaigns]
         return [Link._fullname_from_id36(to36(id)) for id in link_ids]
     elif self.sort == 'reported':
         return queries.get_reported_links(Subreddit.get_promote_srid())
     elif self.sort == 'house':
         return self.get_house_link_names()
     elif self.sort == 'all':
         return queries.get_all_promoted_links()
开发者ID:Asiant,项目名称:reddit,代码行数:27,代码来源:promotecontroller.py

示例4: should_index

# 需要导入模块: from r2.models import Subreddit [as 别名]
# 或者: from r2.models.Subreddit import get_promote_srid [as 别名]
 def should_index(self, thing):
     return thing._id != Subreddit.get_promote_srid()
开发者ID:judys-io,项目名称:reddit,代码行数:4,代码来源:cloudsearch.py

示例5: _get_subreddit

# 需要导入模块: from r2.models import Subreddit [as 别名]
# 或者: from r2.models.Subreddit import get_promote_srid [as 别名]
def _get_subreddit():
    return Subreddit._byID(Subreddit.get_promote_srid())
开发者ID:dwick,项目名称:reddit-plugin-dfp,代码行数:4,代码来源:linkcontroller.py

示例6: get_dfp_subreddit

# 需要导入模块: from r2.models import Subreddit [as 别名]
# 或者: from r2.models.Subreddit import get_promote_srid [as 别名]
def get_dfp_subreddit():
    from r2.models import Subreddit
    return Subreddit._byID(Subreddit.get_promote_srid())
开发者ID:13steinj,项目名称:reddit-plugin-dfp,代码行数:5,代码来源:utils.py


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