示例#1
0
def set_cleanliness_flags_for_enabled_domains(force_full=False):
    """
    Updates cleanliness for all domains that have the toggle enabled
    """
    for domain in Domain.get_all_names():
        if OWNERSHIP_CLEANLINESS.enabled(domain):
            set_cleanliness_flags_for_domain(domain, force_full=force_full)
示例#2
0
def set_cleanliness_flags_for_enabled_domains(force_full=False):
    """
    Updates cleanliness for all domains that have the toggle enabled
    """
    for domain in Domain.get_all_names():
        if OWNERSHIP_CLEANLINESS.enabled(domain):
            try:
                set_cleanliness_flags_for_domain(domain, force_full=force_full)
            except InvalidDomainError as e:
                notify_exception(None, unicode(e))
示例#3
0
def should_track_cleanliness(domain):
    """
    Whether a domain should track cleanliness on submission.
    """
    if settings.UNIT_TESTING:
        override = getattr(settings, 'TESTS_SHOULD_TRACK_CLEANLINESS', None)
        if override is not None:
            return override

    return domain and OWNERSHIP_CLEANLINESS.enabled(domain)
示例#4
0
def set_cleanliness_flags_for_enabled_domains(force_full=False):
    """
    Updates cleanliness for all domains that have the toggle enabled
    """
    for domain in Domain.get_all_names():
        if OWNERSHIP_CLEANLINESS.enabled(domain):
            try:
                set_cleanliness_flags_for_domain(domain, force_full=force_full)
            except InvalidDomainError as e:
                notify_exception(None, unicode(e))
示例#5
0
def should_track_cleanliness(domain):
    """
    Whether a domain should track cleanliness on submission.
    """
    if settings.UNIT_TESTING:
        override = getattr(
            settings, 'TESTS_SHOULD_TRACK_CLEANLINESS', None)
        if override is not None:
            return override

    return domain and OWNERSHIP_CLEANLINESS.enabled(domain)
 def handle(self, *args, **kwargs):
     from casexml.apps.phone.cleanliness import set_cleanliness_flags_for_domain
     if len(args) == 1:
         domain = args[0]
         set_cleanliness_flags_for_domain(domain)
     else:
         assert len(args) == 0
         for domain in Domain.get_all_names():
             if OWNERSHIP_CLEANLINESS.enabled(domain):
                 print 'updating flags for {}'.format(domain)
                 set_cleanliness_flags_for_domain(domain)
示例#7
0
 def needs_full_check(domain, cleanliness_obj):
     # if it already is clean we don't need to do anything since that gets invalidated on submission
     return (
         # if clean, only check if the toggle is not enabled since then it won't be properly invalidated
         # on submission
         cleanliness_obj.is_clean and not OWNERSHIP_CLEANLINESS.enabled(domain)
     ) or (
         # if dirty, first check the hint and only do a full check if it's not valid
         not cleanliness_object.is_clean and (
             not cleanliness_object.hint or not hint_still_valid(domain, owner_id, cleanliness_object.hint)
         )
     )
示例#8
0
 def needs_full_check(domain, cleanliness_obj):
     # if it already is clean we don't need to do anything since that gets invalidated on submission
     return (
         # if clean, only check if the toggle is not enabled since then it won't be properly invalidated
         # on submission
         cleanliness_obj.is_clean
         and not OWNERSHIP_CLEANLINESS.enabled(domain)
     ) or (
         # if dirty, first check the hint and only do a full check if it's not valid
         not cleanliness_object.is_clean and
         (not cleanliness_object.hint or
          not hint_still_valid(domain, owner_id, cleanliness_object.hint)))