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


Python PromotionWeights.add方法代码示例

本文整理汇总了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
开发者ID:caseypatrickdriscoll,项目名称:reddit,代码行数:12,代码来源:promote.py

示例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
开发者ID:karthikv,项目名称:reddit,代码行数:14,代码来源:promote.py

示例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
开发者ID:j2p2,项目名称:reddit,代码行数:16,代码来源:promote.py

示例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
开发者ID:SteveCastle,项目名称:reddit,代码行数:16,代码来源:promote.py

示例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
开发者ID:AD42,项目名称:reddit,代码行数:18,代码来源:promote.py

示例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
开发者ID:travmi,项目名称:reddit,代码行数:47,代码来源:promote.py

示例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
开发者ID:pra85,项目名称:reddit,代码行数:20,代码来源:promote.py


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