Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixups for admin SponsorLogo upload. #9794

Merged
merged 5 commits into from
Jul 14, 2021
Merged

Conversation

ewdurbin
Copy link
Member

No description provided.

@ewdurbin
Copy link
Member Author

added resolutions to comments from #9792 (review)

@ewdurbin ewdurbin changed the title ensure prefix is applied for GCSSponsorLogoStorage Fixups for admin SponsorLogo upload. Jul 14, 2021
@ewdurbin ewdurbin merged commit 621bd2a into main Jul 14, 2021
@ewdurbin ewdurbin deleted the prefix_gcs_sponsor_logo_storage branch July 14, 2021 20:29
sponsor_name = slugify(form.name.data)
if request.POST.get("white_logo") not in [None, b""]:
if request.POST.get(image_name) not in [None, b""]:
Copy link
Contributor

@ewjoachim ewjoachim Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(slight remark, but this is more simply expressed as if request.POST.get(image_name):, no ?)

fingerprint = secrets.token_urlsafe(6)
filename = f"{sponsor_name}-{slugify(image_name)}-{fingerprint}{extension}"
return storage.store(filename, fp.name)
return ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't return None be more explicit ? (or an exception)

domdfcoding pushed a commit to domdfcoding/warehouse that referenced this pull request Jun 7, 2022
* ensure prefix is applied for GCSSponsorLogoStorage

* lint

* sponsor logos: deduplicate upload code, fingerprint uploads

* my first walrus

* fix coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants