1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/c1d5b67e2090/ changeset: c1d5b67e2090 branches: user: greg date: 2011-06-01 21:47:04 summary: Fixes for editing role name, descriptionn, and renaming groups. Resolves issue #539. affected #: 2 files (479 bytes) --- a/lib/galaxy/web/base/controller.py Wed Jun 01 15:20:43 2011 -0400 +++ b/lib/galaxy/web/base/controller.py Wed Jun 01 15:47:04 2011 -0400 @@ -1278,20 +1278,23 @@ if not new_name: message = 'Enter a valid name' status='error' - elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==new_name ).first(): - message = 'A role with that name already exists' - status = 'error' else: - role.name = new_name - role.description = new_description - trans.sa_session.add( role ) - trans.sa_session.flush() - message = "Role '%s' has been renamed to '%s'" % ( old_name, new_name ) - return trans.response.send_redirect( web.url_for( controller='admin', - action='roles', - webapp=webapp, - message=util.sanitize_text( message ), - status='done' ) ) + existing_role = trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==new_name ).first() + if existing_role and existing_role.id != role.id: + message = 'A role with that name already exists' + status = 'error' + else: + if not ( role.name == new_name and role.description == new_description ): + role.name = new_name + role.description = new_description + trans.sa_session.add( role ) + trans.sa_session.flush() + message = "Role '%s' has been renamed to '%s'" % ( old_name, new_name ) + return trans.response.send_redirect( web.url_for( controller='admin', + action='roles', + webapp=webapp, + message=util.sanitize_text( message ), + status='done' ) ) return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, webapp=webapp, @@ -1556,19 +1559,22 @@ if not new_name: message = 'Enter a valid name' status = 'error' - elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==new_name ).first(): - message = 'A group with that name already exists' - status = 'error' else: - group.name = new_name - trans.sa_session.add( group ) - trans.sa_session.flush() - message = "Group '%s' has been renamed to '%s'" % ( old_name, new_name ) - return trans.response.send_redirect( web.url_for( controller='admin', - action='groups', - webapp=webapp, - message=util.sanitize_text( message ), - status='done' ) ) + existing_group = trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==new_name ).first() + if existing_group and existing_group.id != group.id: + message = 'A group with that name already exists' + status = 'error' + else: + if group.name != new_name: + group.name = new_name + trans.sa_session.add( group ) + trans.sa_session.flush() + message = "Group '%s' has been renamed to '%s'" % ( old_name, new_name ) + return trans.response.send_redirect( web.url_for( controller='admin', + action='groups', + webapp=webapp, + message=util.sanitize_text( message ), + status='done' ) ) return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, webapp=webapp, --- a/lib/galaxy/web/controllers/admin.py Wed Jun 01 15:20:43 2011 -0400 +++ b/lib/galaxy/web/controllers/admin.py Wed Jun 01 15:47:04 2011 -0400 @@ -169,7 +169,7 @@ global_actions = [ grids.GridAction( "Add new role", dict( controller='admin', action='roles', operation='create' ) ) ] - operations = [ grids.GridOperation( "Rename", + operations = [ grids.GridOperation( "Edit", condition=( lambda item: not item.deleted ), allow_multiple=False, url_args=dict( webapp="galaxy", action="rename_role" ) ), 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.