def _domain_has_apps_using_custom_intents(domain):
    templates = next(app_callout_templates)
    template_ids = set([t['id'] for t in templates])
    return any(
        any(
            any(set(form.wrapped_xform().odk_intents) - template_ids)
            for form in app.get_forms()) for app in get_all_apps(domain.name))
def _domain_has_apps_using_custom_intents(domain_obj):
    templates = next(app_callout_templates)
    template_ids = set([t['id'] for t in templates])
    return any(
        any(
            any(set(form.wrapped_xform().odk_intents) - template_ids)
            for form in app.get_forms()
        )
        for app in get_all_apps(domain_obj.name)
    )
Exemple #3
0
def archive_logos(domain_name):
    try:
        for app in get_all_apps(domain_name):
            if isinstance(app, HQMediaMixin):
                has_archived = app.archive_logos()
                if has_archived:
                    app.save()
    except Exception as e:
        log_accounting_error(
            "Failed to remove all commcare logos for domain %s." % domain_name,
            show_stack_trace=True,
        )
        raise e
Exemple #4
0
def restore_logos(self, domain_name):
    try:
        for app in get_all_apps(domain_name):
            if isinstance(app, HQMediaMixin):
                has_restored = app.restore_logos()
                if has_restored:
                    app.save()
    except ResourceConflict as e:
        raise self.retry(exc=e)
    except Exception as e:
        log_accounting_error(
            "Failed to restore all commcare logos for domain %s." % domain_name,
            show_stack_trace=True,
        )
        raise e
 def response_commcare_logo_uploader(domain, new_plan_version):
     """Make sure no existing applications are using a logo.
     """
     try:
         for app in get_all_apps(domain.name):
             if isinstance(app, HQMediaMixin):
                 has_restored = app.restore_logos()
                 if has_restored:
                     app.save()
         return True
     except Exception:
         log_accounting_error(
             "Failed to restore all commcare logos for domain %s." %
             domain.name)
         return False
 def response_commcare_logo_uploader(self):
     """Make sure no existing applications are using a logo.
     """
     try:
         for app in get_all_apps(self.domain.name):
             has_restored = app.restore_logos()
             if has_restored:
                 app.save()
         return True
     except Exception:
         log_accounting_error(
             "Failed to restore all commcare logos for domain %s."
             % self.domain.name
         )
         return False
Exemple #7
0
def restore_logos(self, domain_name):
    try:
        for app in get_all_apps(domain_name):
            if isinstance(app, ApplicationMediaMixin):
                has_restored = app.restore_logos()
                if has_restored:
                    app.save()
    except ResourceConflict as e:
        raise self.retry(exc=e)
    except Exception as e:
        log_accounting_error(
            "Failed to restore all commcare logos for domain %s." % domain_name,
            show_stack_trace=True,
        )
        raise e
 def response_commcare_logo_uploader(domain, new_plan_version):
     """Make sure no existing applications are using a logo.
     """
     try:
         for app in get_all_apps(domain.name):
             has_archived = app.archive_logos()
             if has_archived:
                 app.save()
         return True
     except Exception:
         log_accounting_error(
             "Failed to remove all commcare logos for domain %s."
             % domain.name
         )
         return False
Exemple #9
0
 def response_commcare_logo_uploader(domain, new_plan_version):
     """Make sure no existing applications are using a logo.
     """
     try:
         for app in get_all_apps(domain.name):
             if isinstance(app, Application):
                 has_archived = app.archive_logos()
                 if has_archived:
                     app.save()
         return True
     except Exception:
         log_accounting_error(
             "Failed to remove all commcare logos for domain %s." % domain.name,
             show_stack_trace=True,
         )
         return False