Example #1
0
def _upload(request, addon=None, is_standalone=False):
    user = request.user
    # If there is no user, default to None (saves the file upload as anon).
    form = NewPackagedAppForm(request.POST, request.FILES, user=user if user.is_authenticated() else None, addon=addon)
    if form.is_valid():
        validator.delay(form.file_upload.pk)

    if addon:
        return redirect("mkt.developers.upload_detail_for_addon", addon.app_slug, form.file_upload.pk)
    elif is_standalone:
        return redirect("mkt.developers.standalone_upload_detail", "packaged", form.file_upload.pk)
    else:
        return redirect("mkt.developers.upload_detail", form.file_upload.pk, "json")
Example #2
0
def _upload(request, addon=None, is_standalone=False):

    # If there is no user, default to None (saves the file upload as anon).
    form = NewPackagedAppForm(request.POST, request.FILES, user=getattr(request, "amo_user", None), addon=addon)
    if form.is_valid():
        tasks.validator.delay(form.file_upload.pk)

    if addon:
        return redirect("mkt.developers.upload_detail_for_addon", addon.app_slug, form.file_upload.pk)
    elif is_standalone:
        return redirect("mkt.developers.standalone_upload_detail", "packaged", form.file_upload.pk)
    else:
        return redirect("mkt.developers.upload_detail", form.file_upload.pk, "json")
Example #3
0
def upload(request, addon_slug=None, is_standalone=False):
    form = NewPackagedAppForm(request.POST, request.FILES,
                              user=request.amo_user)
    if form.is_valid():
        tasks.validator.delay(form.file_upload.pk)

    if addon_slug:
        return redirect('mkt.developers.upload_detail_for_addon',
                        addon_slug, form.file_upload.pk)
    elif is_standalone:
        return redirect('mkt.developers.standalone_upload_detail',
                        'packaged', form.file_upload.pk)
    else:
        return redirect('mkt.developers.upload_detail',
                        form.file_upload.pk, 'json')
Example #4
0
def _upload(request, addon_slug=None, is_standalone=False):
    # If there is no user, default to None (saves the file upload as anon).
    form = NewPackagedAppForm(request.POST, request.FILES,
                              user=getattr(request, 'amo_user', None))
    if form.is_valid():
        tasks.validator.delay(form.file_upload.pk)

    if addon_slug:
        return redirect('mkt.developers.upload_detail_for_addon',
                        addon_slug, form.file_upload.pk)
    elif is_standalone:
        return redirect('mkt.developers.standalone_upload_detail',
                        'packaged', form.file_upload.pk)
    else:
        return redirect('mkt.developers.upload_detail',
                        form.file_upload.pk, 'json')
Example #5
0
def _upload(request, addon_slug=None, is_standalone=False):
    # If there is no user, default to None (saves the file upload as anon).
    form = NewPackagedAppForm(request.POST,
                              request.FILES,
                              user=getattr(request, 'amo_user', None))
    if form.is_valid():
        tasks.validator.delay(form.file_upload.pk)

    if addon_slug:
        return redirect('mkt.developers.upload_detail_for_addon', addon_slug,
                        form.file_upload.pk)
    elif is_standalone:
        return redirect('mkt.developers.standalone_upload_detail', 'packaged',
                        form.file_upload.pk)
    else:
        return redirect('mkt.developers.upload_detail', form.file_upload.pk,
                        'json')
Example #6
0
def _upload(request, addon=None, is_standalone=False):
    user = request.user
    # If there is no user, default to None (saves the file upload as anon).
    form = NewPackagedAppForm(request.POST, request.FILES,
                              user=user if user.is_authenticated() else None,
                              addon=addon)
    if form.is_valid():
        validator.delay(form.file_upload.pk)

    if addon:
        return redirect('mkt.developers.upload_detail_for_addon',
                        addon.app_slug, form.file_upload.pk)
    elif is_standalone:
        return redirect('mkt.developers.standalone_upload_detail',
                        'packaged', form.file_upload.pk)
    else:
        return redirect('mkt.developers.upload_detail',
                        form.file_upload.pk, 'json')