本文整理汇总了Python中r2.models.PromotionWeights.add方法的典型用法代码示例。如果您正苦于以下问题:Python PromotionWeights.add方法的具体用法?Python PromotionWeights.add怎么用?Python PromotionWeights.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r2.models.PromotionWeights
的用法示例。
在下文中一共展示了PromotionWeights.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(link, dates, bid, sr):
# empty string for sr_name means target to all
sr_name = sr.name if sr else ""
campaign = PromoCampaign._new(link, sr_name, bid, dates[0], dates[1])
PromotionWeights.add(link, campaign._id, sr_name, dates[0], dates[1], bid)
PromotionLog.add(link, 'campaign %s created' % campaign._id)
author = Account._byID(link.author_id, True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
return campaign
示例2: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(link, dates, bid, cpm, target, priority, location, platform, mobile_os):
campaign = PromoCampaign.create(link, target, bid, cpm, dates[0], dates[1], priority, location, platform, mobile_os)
PromotionWeights.add(link, campaign)
PromotionLog.add(link, "campaign %s created" % campaign._id)
if campaign.priority.cpm:
author = Account._byID(link.author_id, data=True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
hooks.get_hook("promote.new_campaign").call(link=link, campaign=campaign)
return campaign
示例3: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(link, dates, bid, cpm, sr, priority, location):
# empty string for sr_name means target to all
sr_name = sr.name if sr else ""
campaign = PromoCampaign._new(link, sr_name, bid, cpm, dates[0], dates[1], priority, location)
PromotionWeights.add(link, campaign._id, sr_name, dates[0], dates[1], bid)
PromotionLog.add(link, "campaign %s created" % campaign._id)
if campaign.priority.cpm:
author = Account._byID(link.author_id, data=True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
hooks.get_hook("promote.new_campaign").call(link=link, campaign=campaign)
return campaign
示例4: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(link, dates, bid, cpm, target, priority, location):
campaign = PromoCampaign.create(link, target, bid, cpm, dates[0], dates[1],
priority, location)
PromotionWeights.add(link, campaign._id, target.subreddit_names, dates[0],
dates[1], bid)
PromotionLog.add(link, 'campaign %s created' % campaign._id)
if campaign.priority.cpm:
author = Account._byID(link.author_id, data=True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
hooks.get_hook('promote.new_campaign').call(link=link, campaign=campaign)
return campaign
示例5: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(link, dates, bid, cpm, sr, priority):
# empty string for sr_name means target to all
sr_name = sr.name if sr else ""
campaign = PromoCampaign._new(link, sr_name, bid, cpm, dates[0], dates[1],
priority)
PromotionWeights.add(link, campaign._id, sr_name, dates[0], dates[1], bid)
PromotionLog.add(link, 'campaign %s created' % campaign._id)
if campaign.priority.cpm:
author = Account._byID(link.author_id, data=True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
else:
# non-cpm campaigns are never charged, so we need to fire the hook now
hooks.get_hook('promote.new_charge').call(link=link, campaign=campaign)
return campaign
示例6: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(
link,
dates,
target,
frequency_cap,
priority,
location,
platform,
mobile_os,
ios_devices,
ios_version_range,
android_devices,
android_version_range,
total_budget_pennies,
cost_basis,
bid_pennies,
):
campaign = PromoCampaign.create(
link,
target,
dates[0],
dates[1],
frequency_cap,
priority,
location,
platform,
mobile_os,
ios_devices,
ios_version_range,
android_devices,
android_version_range,
total_budget_pennies,
cost_basis,
bid_pennies,
)
PromotionWeights.add(link, campaign)
PromotionLog.add(link, "campaign %s created" % campaign._id)
if not campaign.is_house:
author = Account._byID(link.author_id, data=True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
hooks.get_hook("promote.new_campaign").call(link=link, campaign=campaign)
return campaign
示例7: new_campaign
# 需要导入模块: from r2.models import PromotionWeights [as 别名]
# 或者: from r2.models.PromotionWeights import add [as 别名]
def new_campaign(link, dates, bid, cpm, target, frequency_cap, frequency_cap_duration,
priority, location, platform, mobile_os, ios_devices,
ios_version_range, android_devices, android_version_range):
campaign = PromoCampaign.create(link, target, bid, cpm, dates[0], dates[1],
frequency_cap, frequency_cap_duration, priority,
location, platform, mobile_os, ios_devices,
ios_version_range, android_devices,
android_version_range)
PromotionWeights.add(link, campaign)
PromotionLog.add(link, 'campaign %s created' % campaign._id)
if campaign.priority.cpm:
author = Account._byID(link.author_id, data=True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, campaign, c.user)
hooks.get_hook('promote.new_campaign').call(link=link, campaign=campaign)
return campaign