Skip to content

Constraint on normalized organization names #17998

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

Merged
merged 3 commits into from
Apr 21, 2025
Merged

Conversation

di
Copy link
Member

@di di commented Apr 21, 2025

No description provided.

@di di requested a review from a team as a code owner April 21, 2025 16:42
@di di force-pushed the unique-org-names branch from 1414a21 to ba5e128 Compare April 21, 2025 16:44
@di di force-pushed the unique-org-names branch from ba5e128 to ce81611 Compare April 21, 2025 16:44
@di
Copy link
Member Author

di commented Apr 21, 2025

I think the OrganizationNameCatalog is totally unnecessary now?

@di
Copy link
Member Author

di commented Apr 21, 2025

I think the OrganizationNameCatalog is totally unnecessary now?

Oh, no, this is also keeping a record of previous organization names that have since been changed.

@di di added the blocked Issues we can't or shouldn't get to yet label Apr 21, 2025
@di
Copy link
Member Author

di commented Apr 21, 2025

Marking as blocked for merging until we manually clean up the duplicate orgs currently in the DB.

@@ -538,6 +540,10 @@ class OrganizationApplication(OrganizationMixin, HasObservations, db.Model):
__tablename__ = "organization_applications"
__repr__ = make_repr("name")

@declared_attr
Copy link
Member

Choose a reason for hiding this comment

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

did a giant double take wondering how

conflicting_applications = (
request.db.query(OrganizationApplication)
.filter(
OrganizationApplication.normalized_name
== organization_application.normalized_name
)
.filter(OrganizationApplication.id != organization_application.id)
.order_by(OrganizationApplication.submitted)
.all()
)
had been working, and realized it was via inheritance.

@ewdurbin ewdurbin merged commit 70327c8 into pypi:main Apr 21, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Issues we can't or shouldn't get to yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants