1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9a4b43021fd1/ Changeset: 9a4b43021fd1 Branch: stable User: jmchilton Date: 2014-08-25 18:36:34 Summary: Bugfix for 0750859: Don't generate duplicate workflow slugs for private workflows. See full conversation on https://bitbucket.org/galaxy/galaxy-central/commits/07508592cb65845474b9f3e0.... Would like to better and allow slugs of deleted items to be reused - they cannot be for workflows for instance. Because the slugs are not really handled uniformly though - pages do not have this problem and deleted pages can have their slugs reused because this is included in a check in the web controller which directly assigns valid slugs at that point. Slugs for deleted histories cannot be re-used - but they couldn't be prior to this commit - so this isn't making things worse in that respect. Affected #: 1 file diff -r d86834553f0e2d3636b3f545f61ae3250ead31e9 -r 9a4b43021fd1c5808c17329da7b6acbfd9ae27ed lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -27,7 +27,7 @@ from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField from galaxy.web.form_builder import build_select_field, HistoryField, PasswordField, WorkflowField, WorkflowMappingField from galaxy.workflow.modules import module_factory -from galaxy.model.orm import eagerload, eagerload_all, desc +from galaxy.model.orm import eagerload, eagerload_all, desc, not_ from galaxy.security.validate_user_input import validate_publicname from galaxy.util.sanitize_html import sanitize_html from galaxy.model.item_attrs import Dictifiable, UsesAnnotations @@ -2694,7 +2694,7 @@ 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, importable=True ).count() == 0: + if trans.sa_session.query( item.__class__ ).filter_by( user=item.user, slug=new_slug ).count() == 0: item.slug = new_slug trans.sa_session.flush() @@ -2729,7 +2729,9 @@ # add integer to end. new_slug = slug_base count = 1 - while sa_session.query( item.__class__ ).filter_by( user=item.user, slug=new_slug, importable=True ).count() != 0: + # Ensure unique across model class and user and don't include this item + # in the check in case it has previously been assigned a valid slug. + while sa_session.query( item.__class__ ).filter( item.__class__.user == item.user, item.__class__.slug == new_slug, item.__class__.id != item.id).count() != 0: # Slug taken; choose a new slug based on count. This approach can # handle numerous items with the same name gracefully. new_slug = '%s-%i' % ( slug_base, count ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.