Docstring/PEP 257 fixes for the donate app (#2821)
parent
a3d85dfea4
commit
b1001675e8
|
@ -66,7 +66,7 @@ class SupporterPromo(models.Model):
|
|||
return self.name
|
||||
|
||||
def as_dict(self):
|
||||
"A dict respresentation of this for JSON encoding"
|
||||
"""A dict respresentation of this for JSON encoding"""
|
||||
hash = get_random_string()
|
||||
domain = getattr(settings, 'PRODUCTION_DOMAIN', 'readthedocs.org')
|
||||
if self.image:
|
||||
|
@ -191,6 +191,7 @@ class BaseImpression(models.Model):
|
|||
|
||||
|
||||
class PromoImpressions(BaseImpression):
|
||||
|
||||
"""
|
||||
Track stats around how successful this promo has been.
|
||||
|
||||
|
@ -202,6 +203,7 @@ class PromoImpressions(BaseImpression):
|
|||
|
||||
|
||||
class ProjectImpressions(BaseImpression):
|
||||
|
||||
"""
|
||||
Track stats for a specific project and promo.
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ def show_to_programming_language(promo, programming_language):
|
|||
Return True if we haven't set a specific language,
|
||||
which means show to all languages.
|
||||
"""
|
||||
|
||||
if promo.programming_language:
|
||||
return programming_language == promo.programming_language
|
||||
return True
|
||||
|
@ -70,8 +69,8 @@ def choose_promo(promo_list):
|
|||
(The number of views from this day last week)
|
||||
Then we can scale the "total ads sold" against that "expected views",
|
||||
and that will give us more spread throughout the day.
|
||||
"""
|
||||
|
||||
"""
|
||||
promo_range = []
|
||||
total_views_needed = 0
|
||||
for promo in promo_list:
|
||||
|
@ -98,8 +97,8 @@ def get_promo(country_code, programming_language, theme, gold_project=False, gol
|
|||
* Gold Project status
|
||||
* Geo
|
||||
* Programming Language
|
||||
"""
|
||||
|
||||
"""
|
||||
promo_queryset = SupporterPromo.objects.filter(live=True, display_type='doc')
|
||||
|
||||
filtered_promos = []
|
||||
|
|
|
@ -24,7 +24,6 @@ def offer_promo(promo_obj, project=None):
|
|||
This generated a hash as part of the return dict,
|
||||
so that must be used throughout the processing pipeline in order to dedupe clicks.
|
||||
"""
|
||||
|
||||
promo_dict = promo_obj.as_dict()
|
||||
promo_obj.incr(OFFERS)
|
||||
# Set validation cache
|
||||
|
|
Loading…
Reference in New Issue