Skip to content

Commit

Permalink
Fix SA2.0 usage in webapps.base.controller (3)
Browse files Browse the repository at this point in the history
Reuse slug_exists function
  • Loading branch information
jdavcs committed Oct 25, 2023
1 parent a4feba5 commit 1956de1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/galaxy/webapps/base/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
)

from sqlalchemy import (
func,
select,
true,
)
Expand Down Expand Up @@ -1316,7 +1317,7 @@ def set_slug_async(self, trans, id, new_slug):
item = self.get_item(trans, id)
if item:
# Only update slug if slug is not already in use.
if trans.sa_session.query(item.__class__).filter_by(user=item.user, slug=new_slug).count() == 0:
if not slug_exists(trans.sa_session, item.__class__, item.user, new_slug):
item.slug = new_slug
with transaction(trans.sa_session):
trans.sa_session.commit()
Expand Down

0 comments on commit 1956de1

Please sign in to comment.