示例#1
0
        'qs': [
            Q(_current_version__files__is_webextension=True,
              type__in=(
                  # Ignoring legacy add-ons and lightweight themes
                  amo.ADDON_EXTENSION, amo.ADDON_STATICTHEME,
                  amo.ADDON_DICT, amo.ADDON_LPAPP)) |
            Q(type=amo.ADDON_SEARCH)
        ]
    },
    'extract_colors_from_static_themes': {
        'method': extract_colors_from_static_themes,
        'qs': [Q(type=amo.ADDON_STATICTHEME)]
    },
    'delete_armagaddon_ratings_for_addons': {
        'method': delete_armagaddon_ratings_for_addons,
        'qs': [Q(**get_armagaddon_ratings_filters(prefix='_ratings__'))],
        'distinct': True,
    },
    'content_approve_migrated_themes': {
        'method': content_approve_migrated_themes,
        'qs': [Q(migrated_from_lwt__isnull=False,
                 type=amo.ADDON_STATICTHEME, status=amo.STATUS_APPROVED,
                 addonapprovalscounter__last_content_review__isnull=True)]
    }
}


class Command(BaseCommand):
    """
    A generic command to run a task on addons.
    Add tasks to the tasks dictionary, providing a list of Q objects if you'd
示例#2
0
        'qs': [
            Q(_current_version__files__is_webextension=True,
              type__in=(
                  # Ignoring legacy add-ons and lightweight themes
                  amo.ADDON_EXTENSION, amo.ADDON_STATICTHEME,
                  amo.ADDON_DICT, amo.ADDON_LPAPP)) |
            Q(type=amo.ADDON_SEARCH)
        ]
    },
    'extract_colors_from_static_themes': {
        'method': extract_colors_from_static_themes,
        'qs': [Q(type=amo.ADDON_STATICTHEME)]
    },
    'delete_armagaddon_ratings_for_addons': {
        'method': delete_armagaddon_ratings_for_addons,
        'qs': [Q(**get_armagaddon_ratings_filters(prefix='_ratings__'))],
        'distinct': True,
    },
}


class Command(BaseCommand):
    """
    A generic command to run a task on addons.
    Add tasks to the tasks dictionary, providing a list of Q objects if you'd
    like to filter the list down.

    method: the method to delay
    pre: a method to further pre process the pks, must return the pks (opt.)
    qs: a list of Q objects to apply to the method
    kwargs: any extra kwargs you want to apply to the delay method (optional)