本文整理汇总了Python中r2.lib.emailer.new_promo函数的典型用法代码示例。如果您正苦于以下问题:Python new_promo函数的具体用法?Python new_promo怎么用?Python new_promo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new_promo函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: new_promotion
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(get_promote_srid())
l = Link._submit(title, url, user, sr, ip)
l.promoted = True
l.disable_comments = False
PromotionLog.add(l, 'promotion created')
if url == 'self':
l.url = l.make_permalink_slow()
l.is_self = True
l.selftext = selftext
l._commit()
# set the status of the link, populating the query queue
if c.user_is_sponsor or user.trusted_sponsor:
set_promote_status(l, PROMOTE_STATUS.accepted)
else:
set_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:AD42,项目名称:reddit,代码行数:33,代码来源:promote.py
示例2: new_promotion
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,代码行数:31,代码来源:promote.py
示例3: new_promotion
def new_promotion(title, url, user, ip, promote_start, promote_until, bid,
disable_comments = False,
max_clicks = None, max_views = None):
"""
Creates a new promotion with the provided title, etc, and sets it
status to be 'unpaid'.
"""
l = Link._submit(title, url, user, PromoteSR, ip)
l.promoted = True
l.promote_until = None
l.promote_status = STATUS.unpaid
l.promote_trans_id = 0
l.promote_bid = bid
l.maximum_clicks = max_clicks
l.maximum_views = max_views
l.disable_comments = disable_comments
update_promo_dates(l, promote_start, promote_until)
promotion_log(l, "promotion created")
l._commit()
# 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()
emailer.new_promo(l)
return l
开发者ID:kevinrose,项目名称:diggit,代码行数:26,代码来源:promote.py
示例4: new_promotion
def new_promotion(title, url, user, ip):
"""
Creates a new promotion with the provided title, etc, and sets it
status to be 'unpaid'.
"""
sr = Subreddit._byID(get_promote_srid())
l = Link._submit(title, url, user, sr, ip)
l.promoted = True
l.disable_comments = False
l.campaigns = {}
promotion_log(l, "promotion created")
l._commit()
# set the status of the link, populating the query queue
if c.user_is_sponsor or user.trusted_sponsor:
set_status(l, STATUS.accepted)
else:
set_status(l, 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:JediWatchman,项目名称:reddit,代码行数:28,代码来源:promote.py
示例5: new_promotion
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(get_promote_srid())
l = Link._submit(title, url, user, sr, ip)
l.promoted = True
l.disable_comments = False
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:j2p2,项目名称:reddit,代码行数:29,代码来源:promote.py
注:本文中的r2.lib.emailer.new_promo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论