def __init__(self, *a, **kw): # circular if imported on the module level from r2.lib import promote self.nextprev = False self.show_nums = True self._parent_max_num = kw.get("max_num", 0) self._parent_max_score = kw.get("max_score", 0) self.interestbar = kw.get("interestbar") self.interestbar_prob = kw.get("interestbar_prob", 0.0) self.show_promo = kw.get("show_promo", False) self.house_probability = kw.get("house_probability", 1) self.displayed_things = ",".join(kw.get("displayed_things", [])) self.new_ads_styles_enabled = promote.ads_feature_enabled("new_ads_styles") self.promo_site_path = promote.get_site_path(c.site) self.navigable = kw.get("navigable", True) self.things = kw.get("organic_links", [])
def __init__(self, *a, **kw): # circular if imported on the module level from r2.lib import promote self.nextprev = False self.show_nums = True self._parent_max_num = kw.get('max_num', 0) self._parent_max_score = kw.get('max_score', 0) self.interestbar = kw.get('interestbar') self.interestbar_prob = kw.get('interestbar_prob', 0.) self.show_promo = kw.get('show_promo', False) self.house_probability = kw.get('house_probability', 1) self.displayed_things = ','.join(kw.get('displayed_things', [])) self.new_ads_styles_enabled = promote.ads_feature_enabled( "new_ads_styles") self.promo_site_path = promote.get_site_path(c.site) self.navigable = kw.get('navigable', True) self.things = kw.get('organic_links', [])
def __init__(self, *a, **kw): Listing.__init__(self, *a, **kw) # circular if imported on the module level from r2.lib import promote FEED_RAND_VARIANTS = ("random_pos_transparent", "random_pos_grey", "random_pos_blue") FEED_TOP_VARIANTS = ("top_pos_transparent", "top_pos_grey", "top_pos_blue") self.in_feed_ads_enabled = ( promote.headlines_enabled(site=c.site, user=c.user) and kw.get("show_promo_in_listing", False) and promote.ads_feature_enabled("promoted_links_in_feed") ) self.show_nums = kw.get("show_nums", False) self.promo_site_path = promote.get_site_path(c.site) feed_variant = feature.variant("promoted_links_in_feed") if self.in_feed_ads_enabled and feed_variant in FEED_RAND_VARIANTS: self.promo_pos = randint(1, 6) elif self.in_feed_ads_enabled and feed_variant in FEED_TOP_VARIANTS: self.promo_pos = 0
def __init__(self, *a, **kw): Listing.__init__(self, *a, **kw) # circular if imported on the module level from r2.lib import promote FEED_RAND_VARIANTS = ("random_pos_transparent", "random_pos_grey", "random_pos_blue") FEED_TOP_VARIANTS = ("top_pos_transparent", "top_pos_grey", "top_pos_blue") self.in_feed_ads_enabled = ( promote.headlines_enabled(site=c.site, user=c.user) and kw.get("show_promo_in_listing", False) and promote.ads_feature_enabled("promoted_links_in_feed")) self.show_nums = kw.get('show_nums', False) self.promo_site_path = promote.get_site_path(c.site) feed_variant = feature.variant("promoted_links_in_feed") if self.in_feed_ads_enabled and feed_variant in FEED_RAND_VARIANTS: self.promo_pos = randint(1, 6) elif self.in_feed_ads_enabled and feed_variant in FEED_TOP_VARIANTS: self.promo_pos = 0