Example #1
0
def submit_file(addon_pk, file_pk):
    addon = Addon.unfiltered.get(pk=addon_pk)
    file_ = FileUpload.objects.get(pk=file_pk)
    validation = json.loads(file_.validation)
    if (file_.automated_signing and validation["passed_auto_validation"]) or (
        not file_.automated_signing and file_.valid
    ):
        # Import loop.
        from devhub.views import auto_sign_version

        log.info("Creating version for {file_id} that passed " "validation".format(file_id=file_pk))
        version = Version.from_upload(file_, addon, [amo.PLATFORM_ALL.id])
        auto_sign_version(version)
    else:
        log.info("Skipping version creation for {file_id} that failed " "validation".format(file_id=file_pk))
Example #2
0
def submit_file(addon_pk, file_pk):
    addon = Addon.unfiltered.get(pk=addon_pk)
    file_ = FileUpload.objects.get(pk=file_pk)
    validation = json.loads(file_.validation)
    if (file_.automated_signing and validation['passed_auto_validation']) or (
            not file_.automated_signing and file_.valid):
        # Import loop.
        from devhub.views import auto_sign_version

        log.info('Creating version for {file_id} that passed '
                 'validation'.format(file_id=file_pk))
        version = Version.from_upload(file_, addon, [amo.PLATFORM_ALL.id])
        auto_sign_version(version)
    else:
        log.info('Skipping version creation for {file_id} that failed '
                 'validation'.format(file_id=file_pk))
Example #3
0
def create_version_for_upload(addon, file_):
    if (addon.fileupload_set.filter(created__gt=file_.created,
                                    version=file_.version).exists()
            or addon.versions.filter(version=file_.version).exists()):
        log.info('Skipping Version creation for {file_id} that would cause '
                 'duplicate version'.format(file_id=file_.pk))
    else:
        # Import loop.
        from devhub.views import auto_sign_version

        log.info('Creating version for {file_id} that passed '
                 'validation'.format(file_id=file_.pk))
        version = Version.from_upload(file_, addon, [amo.PLATFORM_ALL.id])
        # The add-on's status will be STATUS_NULL when its first version is
        # created because the version has no files when it gets added and it
        # gets flagged as invalid. We need to manually set the status.
        # TODO: Handle sideload add-ons. This assumes the user wants a prelim
        # review since listed and sideload aren't supported for creation yet.
        if addon.status == amo.STATUS_NULL:
            addon.update(status=amo.STATUS_LITE)
        auto_sign_version(version)
Example #4
0
def create_version_for_upload(addon, file_):
    if (addon.fileupload_set.filter(created__gt=file_.created,
                                    version=file_.version).exists()
            or addon.versions.filter(version=file_.version).exists()):
        log.info('Skipping Version creation for {file_id} that would cause '
                 'duplicate version'.format(file_id=file_.pk))
    else:
        # Import loop.
        from devhub.views import auto_sign_version

        log.info('Creating version for {file_id} that passed '
                 'validation'.format(file_id=file_.pk))
        version = Version.from_upload(file_, addon, [amo.PLATFORM_ALL.id])
        # The add-on's status will be STATUS_NULL when its first version is
        # created because the version has no files when it gets added and it
        # gets flagged as invalid. We need to manually set the status.
        # TODO: Handle sideload add-ons. This assumes the user wants a prelim
        # review since listed and sideload aren't supported for creation yet.
        if addon.status == amo.STATUS_NULL:
            addon.update(status=amo.STATUS_LITE)
        auto_sign_version(version)
Example #5
0
def submit_file(addon_pk, file_pk):
    addon = Addon.unfiltered.get(pk=addon_pk)
    file_ = FileUpload.objects.get(pk=file_pk)
    if (file_.passed_all_validations and not addon.fileupload_set.filter(
            created__gt=file_.created, version=file_.version).exists()):
        # Import loop.
        from devhub.views import auto_sign_version

        log.info('Creating version for {file_id} that passed '
                 'validation'.format(file_id=file_pk))
        version = Version.from_upload(file_, addon, [amo.PLATFORM_ALL.id])
        # The add-on'sstatus will be STATUS_NULL when its first version is
        # created because the version has no files when it gets added and it
        # gets flagged as invalid. We need to manually set the status.
        # TODO: Handle sideload add-ons. This assumes the user wants a prelim
        # review since listed and sideload aren't supported for creation yet.
        if addon.status == amo.STATUS_NULL:
            addon.update(status=amo.STATUS_LITE)
        auto_sign_version(version)
    else:
        log.info('Skipping version creation for {file_id} that failed '
                 'validation'.format(file_id=file_pk))