details: http://www.bx.psu.edu/hg/galaxy/rev/f2b6d4f3189c changeset: 3606:f2b6d4f3189c user: Greg Von Kuster <greg@bx.psu.edu> date: Fri Apr 02 16:06:43 2010 -0400 description: Move toward standardizing the way messages are displayed on Galaxy forms by using params 'message' and 'status' instead of 'msg' and 'messagetype'. diffstat: lib/galaxy/web/controllers/admin.py | 140 +- lib/galaxy/web/controllers/forms.py | 76 +- lib/galaxy/web/controllers/history.py | 7 +- lib/galaxy/web/controllers/library.py | 16 +- lib/galaxy/web/controllers/library_admin.py | 46 +- lib/galaxy/web/controllers/library_common.py | 548 +++++++------- lib/galaxy/web/controllers/requests.py | 164 ++-- lib/galaxy/web/controllers/requests_admin.py | 298 +++--- lib/galaxy/web/controllers/root.py | 32 +- lib/galaxy/web/controllers/user.py | 200 ++-- templates/admin/dataset_security/group/group.mako | 4 +- templates/admin/dataset_security/group/group_create.mako | 4 +- templates/admin/dataset_security/group/group_rename.mako | 4 +- templates/admin/dataset_security/role/role.mako | 4 +- templates/admin/dataset_security/role/role_create.mako | 4 +- templates/admin/dataset_security/role/role_rename.mako | 4 +- templates/admin/forms/create_form.mako | 4 +- templates/admin/forms/edit_form.mako | 4 +- templates/admin/forms/show_form_read_only.mako | 4 +- templates/admin/jobs.mako | 4 +- templates/admin/library/new_library.mako | 4 +- templates/admin/memdump.mako | 4 +- templates/admin/reload_tool.mako | 4 +- templates/admin/requests/add_states.mako | 4 +- templates/admin/requests/create_request_type.mako | 4 +- templates/admin/requests/edit_request.mako | 4 +- templates/admin/requests/edit_request_type.mako | 4 +- templates/admin/requests/events.mako | 4 +- templates/admin/requests/get_data.mako | 4 +- templates/admin/requests/new_request.mako | 4 +- templates/admin/requests/reject.mako | 4 +- templates/admin/requests/show_request.mako | 4 +- templates/admin/requests/view_request_type.mako | 4 +- templates/admin/samples/bar_codes.mako | 4 +- templates/admin/samples/events.mako | 4 +- templates/admin/user/reset_password.mako | 4 +- templates/admin/user/user.mako | 4 +- templates/dataset/edit_attributes.mako | 4 +- templates/history/sharing.mako | 4 +- templates/library/browse_libraries.mako | 4 +- templates/library/common/browse_library.mako | 4 +- templates/library/common/edit_template.mako | 4 +- templates/library/common/folder_info.mako | 4 +- templates/library/common/folder_permissions.mako | 4 +- templates/library/common/ldda_edit_info.mako | 4 +- templates/library/common/ldda_info.mako | 4 +- templates/library/common/ldda_permissions.mako | 4 +- templates/library/common/library_dataset_info.mako | 4 +- templates/library/common/library_dataset_permissions.mako | 4 +- templates/library/common/library_info.mako | 4 +- templates/library/common/library_permissions.mako | 4 +- templates/library/common/new_folder.mako | 4 +- templates/library/common/select_template.mako | 4 +- templates/library/common/upload.mako | 4 +- templates/mobile/manage_library.mako | 4 +- templates/requests/edit_request.mako | 4 +- templates/requests/events.mako | 4 +- templates/requests/new_request.mako | 4 +- templates/requests/show_data.mako | 4 +- templates/requests/show_request.mako | 4 +- templates/sample/sample_events.mako | 4 +- templates/user/edit_address.mako | 4 +- templates/user/index.mako | 4 +- templates/user/info.mako | 4 +- templates/user/login.mako | 4 +- templates/user/logout.mako | 4 +- templates/user/new_address.mako | 4 +- templates/user/register.mako | 4 +- templates/user/reset_password.mako | 4 +- 69 files changed, 883 insertions(+), 880 deletions(-) diffs (truncated from 4762 to 3000 lines): diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/admin.py Fri Apr 02 16:06:43 2010 -0400 @@ -263,9 +263,9 @@ @web.require_admin def index( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) - return trans.fill_template( '/admin/index.mako', msg=msg, messagetype=messagetype ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) + return trans.fill_template( '/admin/index.mako', message=message, status=status ) @web.expose @web.require_admin def center( self, trans, **kwd ): @@ -274,17 +274,17 @@ @web.require_admin def reload_tool( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) - return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, msg=msg, messagetype=messagetype ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) + return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, message=message, status=status ) @web.expose @web.require_admin def tool_reload( self, trans, tool_version=None, **kwd ): params = util.Params( kwd ) tool_id = params.tool_id self.app.toolbox.reload( tool_id ) - msg = 'Reloaded tool: ' + tool_id - return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, msg=msg, messagetype='done' ) + message = 'Reloaded tool: ' + tool_id + return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, message=message, status='done' ) # Galaxy Role Stuff @web.expose @@ -312,8 +312,8 @@ @web.require_admin def create_role( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) if params.get( 'create_role_button', False ): name = util.restore_text( params.name ) description = util.restore_text( params.description ) @@ -321,9 +321,9 @@ in_groups = util.listify( params.get( 'in_groups', [] ) ) create_group_for_role = params.get( 'create_group_for_role', 'no' ) if not name or not description: - msg = "Enter a valid name and a description" + message = "Enter a valid name and a description" elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==name ).first(): - msg = "A role with that name already exists" + message = "A role with that name already exists" else: # Create the role role = trans.app.model.Role( name=name, description=description, type=trans.app.model.Role.types.ADMIN ) @@ -340,13 +340,13 @@ # Create the group group = trans.app.model.Group( name=name ) trans.sa_session.add( group ) - msg = "Group '%s' has been created, and role '%s' has been created with %d associated users and %d associated groups" % \ + message = "Group '%s' has been created, and role '%s' has been created with %d associated users and %d associated groups" % \ ( group.name, role.name, len( in_users ), len( in_groups ) ) else: - msg = "Role '%s' has been created with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) ) + message = "Role '%s' has been created with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) ) trans.sa_session.flush() - trans.response.send_redirect( web.url_for( controller='admin', action='roles', message=util.sanitize_text( msg ), status='done' ) ) - trans.response.send_redirect( web.url_for( controller='admin', action='create_role', msg=util.sanitize_text( msg ), messagetype='error' ) ) + trans.response.send_redirect( web.url_for( controller='admin', action='roles', message=util.sanitize_text( message ), status='done' ) ) + trans.response.send_redirect( web.url_for( controller='admin', action='create_role', message=util.sanitize_text( message ), status='error' ) ) out_users = [] for user in trans.sa_session.query( trans.app.model.User ) \ .filter( trans.app.model.User.table.c.deleted==False ) \ @@ -362,39 +362,39 @@ out_users=out_users, in_groups=[], out_groups=out_groups, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose @web.require_admin def rename_role( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) role = get_role( trans, params.id ) if params.get( 'rename_role_button', False ): old_name = role.name new_name = util.restore_text( params.name ) new_description = util.restore_text( params.description ) if not new_name: - msg = 'Enter a valid name' - return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype='error' ) + message = 'Enter a valid name' + return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status='error' ) elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==new_name ).first(): - msg = 'A role with that name already exists' - return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype='error' ) + message = 'A role with that name already exists' + return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status='error' ) else: role.name = new_name role.description = new_description trans.sa_session.add( role ) trans.sa_session.flush() - msg = "Role '%s' has been renamed to '%s'" % ( old_name, new_name ) - return trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( msg ), status='done' ) ) - return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype=messagetype ) + message = "Role '%s' has been renamed to '%s'" % ( old_name, new_name ) + return trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( message ), status='done' ) ) + return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status=status ) @web.expose @web.require_admin def manage_users_and_groups_for_role( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) role = get_role( trans, params.id ) if params.get( 'role_members_edit_button', False ): in_users = [ trans.sa_session.query( trans.app.model.User ).get( x ) for x in util.listify( params.in_users ) ] @@ -414,8 +414,8 @@ in_groups = [ trans.sa_session.query( trans.app.model.Group ).get( x ) for x in util.listify( params.in_groups ) ] trans.app.security_agent.set_entity_role_associations( roles=[ role ], users=in_users, groups=in_groups ) trans.sa_session.refresh( role ) - msg = "Role '%s' has been updated with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) ) - trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( msg ), status=messagetype ) ) + message = "Role '%s' has been updated with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) ) + trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( message ), status=status ) ) in_users = [] out_users = [] in_groups = [] @@ -467,8 +467,8 @@ in_groups=in_groups, out_groups=out_groups, library_dataset_actions=library_dataset_actions, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose @web.require_admin def mark_role_deleted( self, trans, **kwd ): @@ -554,39 +554,39 @@ @web.require_admin def rename_group( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) group = get_group( trans, params.id ) if params.get( 'rename_group_button', False ): old_name = group.name new_name = util.restore_text( params.name ) if not new_name: - msg = 'Enter a valid name' - return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype='error' ) + message = 'Enter a valid name' + return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status='error' ) elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==new_name ).first(): - msg = 'A group with that name already exists' - return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype='error' ) + message = 'A group with that name already exists' + return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status='error' ) else: group.name = new_name trans.sa_session.add( group ) trans.sa_session.flush() - msg = "Group '%s' has been renamed to '%s'" % ( old_name, new_name ) - return trans.response.send_redirect( web.url_for( action='groups', msg=util.sanitize_text( msg ), messagetype='done' ) ) - return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype=messagetype ) + message = "Group '%s' has been renamed to '%s'" % ( old_name, new_name ) + return trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) ) + return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status=status ) @web.expose @web.require_admin def manage_users_and_roles_for_group( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) group = get_group( trans, params.id ) if params.get( 'group_roles_users_edit_button', False ): in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( x ) for x in util.listify( params.in_roles ) ] in_users = [ trans.sa_session.query( trans.app.model.User ).get( x ) for x in util.listify( params.in_users ) ] trans.app.security_agent.set_entity_group_associations( groups=[ group ], roles=in_roles, users=in_users ) trans.sa_session.refresh( group ) - msg += "Group '%s' has been updated with %d associated roles and %d associated users" % ( group.name, len( in_roles ), len( in_users ) ) - trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status=messagetype ) ) + message += "Group '%s' has been updated with %d associated roles and %d associated users" % ( group.name, len( in_roles ), len( in_users ) ) + trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status=status ) ) in_roles = [] out_roles = [] in_users = [] @@ -605,29 +605,29 @@ in_users.append( ( user.id, user.email ) ) else: out_users.append( ( user.id, user.email ) ) - msg += 'Group %s is currently associated with %d roles and %d users' % ( group.name, len( in_roles ), len( in_users ) ) + message += 'Group %s is currently associated with %d roles and %d users' % ( group.name, len( in_roles ), len( in_users ) ) return trans.fill_template( '/admin/dataset_security/group/group.mako', group=group, in_roles=in_roles, out_roles=out_roles, in_users=in_users, out_users=out_users, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose @web.require_admin def create_group( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) if params.get( 'create_group_button', False ): name = util.restore_text( params.name ) in_users = util.listify( params.get( 'in_users', [] ) ) in_roles = util.listify( params.get( 'in_roles', [] ) ) if not name: - msg = "Enter a valid name" + message = "Enter a valid name" elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==name ).first(): - msg = "A group with that name already exists" + message = "A group with that name already exists" else: # Create the group group = trans.app.model.Group( name=name ) @@ -643,9 +643,9 @@ gra = trans.app.model.GroupRoleAssociation( group, role ) trans.sa_session.add( gra ) trans.sa_session.flush() - msg = "Group '%s' has been created with %d associated users and %d associated roles" % ( name, len( in_users ), len( in_roles ) ) - trans.response.send_redirect( web.url_for( controller='admin', action='groups', message=util.sanitize_text( msg ), status='done' ) ) - trans.response.send_redirect( web.url_for( controller='admin', action='create_group', msg=util.sanitize_text( msg ), messagetype='error' ) ) + message = "Group '%s' has been created with %d associated users and %d associated roles" % ( name, len( in_users ), len( in_roles ) ) + trans.response.send_redirect( web.url_for( controller='admin', action='groups', message=util.sanitize_text( message ), status='done' ) ) + trans.response.send_redirect( web.url_for( controller='admin', action='create_group', message=util.sanitize_text( message ), status='error' ) ) out_users = [] for user in trans.sa_session.query( trans.app.model.User ) \ .filter( trans.app.model.User.table.c.deleted==False ) \ @@ -661,8 +661,8 @@ out_users=out_users, in_roles=[], out_roles=out_roles, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose @web.require_admin def mark_group_deleted( self, trans, **kwd ): @@ -671,8 +671,8 @@ group.deleted = True trans.sa_session.add( group ) trans.sa_session.flush() - msg = "Group '%s' has been marked as deleted." % group.name - trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='done' ) ) + message = "Group '%s' has been marked as deleted." % group.name + trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) ) @web.expose @web.require_admin def undelete_group( self, trans, **kwd ): @@ -681,8 +681,8 @@ group.deleted = False trans.sa_session.add( group ) trans.sa_session.flush() - msg = "Group '%s' has been marked as not deleted." % group.name - trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='done' ) ) + message = "Group '%s' has been marked as not deleted." % group.name + trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) ) @web.expose @web.require_admin def purge_group( self, trans, **kwd ): @@ -692,8 +692,8 @@ group = get_group( trans, params.id ) if not group.deleted: # We should never reach here, but just in case there is a bug somewhere... - msg = "Group '%s' has not been deleted, so it cannot be purged." % group.name - trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='error' ) ) + message = "Group '%s' has not been deleted, so it cannot be purged." % group.name + trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='error' ) ) # Delete UserGroupAssociations for uga in group.users: trans.sa_session.delete( uga ) @@ -972,8 +972,8 @@ out_roles=out_roles, in_groups=in_groups, out_groups=out_groups, - msg=message, - messagetype=status ) + message=message, + status=status ) @web.expose @web.require_admin def memdump( self, trans, ids = 'None', sorts = 'None', pages = 'None', new_id = None, new_sort = None, **kwd ): @@ -1020,11 +1020,11 @@ def jobs( self, trans, stop = [], stop_msg = None, cutoff = 180, **kwd ): deleted = [] msg = None - messagetype = None + status = None job_ids = util.listify( stop ) if job_ids and stop_msg in [ None, '' ]: msg = 'Please enter an error message to display to the user describing why the job was terminated' - messagetype = 'error' + status = 'error' elif job_ids: if stop_msg[-1] not in string.punctuation: stop_msg += '.' @@ -1037,7 +1037,7 @@ msg += 's' msg += ' for deletion: ' msg += ', '.join( deleted ) - messagetype = 'done' + status = 'done' cutoff_time = datetime.utcnow() - timedelta( seconds=int( cutoff ) ) jobs = trans.sa_session.query( trans.app.model.Job ) \ .filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time, @@ -1053,7 +1053,7 @@ last_updated[job.id] = '%s hours' % int( delta.seconds / 60 / 60 ) else: last_updated[job.id] = '%s minutes' % int( delta.seconds / 60 ) - return trans.fill_template( '/admin/jobs.mako', jobs = jobs, last_updated = last_updated, cutoff = cutoff, msg = msg, messagetype = messagetype ) + return trans.fill_template( '/admin/jobs.mako', jobs = jobs, last_updated = last_updated, cutoff = cutoff, msg = msg, status = status ) ## ---- Utility methods ------------------------------------------------------- diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/forms.py --- a/lib/galaxy/web/controllers/forms.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/forms.py Fri Apr 02 16:06:43 2010 -0400 @@ -102,8 +102,8 @@ except: return trans.response.send_redirect( web.url_for( controller='forms', action='manage', - msg='Invalid form', - messagetype='error' ) ) + message='Invalid form', + status='error' ) ) return trans.fill_template( '/admin/forms/show_form_read_only.mako', form=fdc.latest_form ) def __form_types_widget(self, trans, selected='none'): @@ -127,16 +127,16 @@ @web.require_admin def new( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) self.__imported_from_file = False if params.get( 'create_form_button', False ): - fd, msg = self.__save_form( trans, fdc_id=None, **kwd ) + fd, message = self.__save_form( trans, fdc_id=None, **kwd ) if not fd: return trans.response.send_redirect( web.url_for( controller='forms', action='new', - msg=msg, - messagetype='error', + message=message, + status='error', name=util.restore_text( params.get( 'name', '' ) ), description=util.restore_text( params.get( 'description', '' ) ) )) self.__get_saved_form( fd ) @@ -158,8 +158,8 @@ ( 'Import from csv file (Optional)', FileField( 'file_data', 40, '' ) ) ] return trans.fill_template( '/admin/forms/create_form.mako', inputs=inputs, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) def __delete( self, trans, **kwd ): id_list = util.listify( kwd['id'] ) delete_failed = [] @@ -205,8 +205,8 @@ edit_template() method in the library_common controller. ''' params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: fdc = trans.sa_session.query( trans.app.model.FormDefinitionCurrent ).get( trans.security.decode_id(kwd['id']) ) except: @@ -219,22 +219,22 @@ # Save changes # if params.get( 'save_changes_button', False ): - fd_new, msg = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd ) + fd_new, message = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd ) # if validation error encountered while saving the form, show the # unsaved form, with the error message if not fd_new: current_form = self.__get_form( trans, **kwd ) return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype='error', response_redirect=response_redirect, **kwd ) + message=message, status='error', response_redirect=response_redirect, **kwd ) # everything went fine. form saved successfully. Show the saved form or redirect # to response_redirect if appropriate. if response_redirect: return trans.response.send_redirect( response_redirect ) fd = fd_new current_form = self.__get_saved_form( fd ) - msg = "The form '%s' has been updated with the changes." % fd.name + message = "The form '%s' has been updated with the changes." % fd.name return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) # # Add a layout grid # @@ -243,7 +243,7 @@ current_form['layout'].append('') # show the form again return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) # # Delete a layout grid # @@ -252,7 +252,7 @@ index = int( kwd[ 'remove_layout_grid_button' ].split( ' ' )[2] ) - 1 del current_form['layout'][index] return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) # # Add a field # @@ -261,7 +261,7 @@ current_form['fields'].append( self.empty_field ) # show the form again with one empty field return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) # # Delete a field # @@ -271,33 +271,33 @@ index = int( kwd[ 'remove_button' ].split( ' ' )[2] ) - 1 del current_form['fields'][index] return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) # # Add SelectField option # elif 'Add' in kwd.values(): - return self.__add_selectbox_option(trans, fd, msg, messagetype, response_redirect=response_redirect, **kwd) + return self.__add_selectbox_option(trans, fd, message, status, response_redirect=response_redirect, **kwd) # # Remove SelectField option # elif 'Remove' in kwd.values(): - return self.__remove_selectbox_option(trans, fd, msg, messagetype, response_redirect=response_redirect, **kwd) + return self.__remove_selectbox_option(trans, fd, message, status, response_redirect=response_redirect, **kwd) # # Refresh page # elif params.get( 'refresh', False ): current_form = self.__get_form( trans, **kwd ) return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) # # Show the form for editing # else: current_form = self.__get_saved_form( fd ) return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) - def __add_selectbox_option( self, trans, fd, msg, messagetype, response_redirect=None, **kwd ): + def __add_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ): ''' This method adds a selectbox option. The kwd dict searched for the field index which needs to be removed @@ -313,13 +313,13 @@ if index == -1: # something wrong happened return self.__show( trans=trans, form=fd, current_form=current_form, - msg='Error in adding selectfield option', - messagetype='error', response_redirect=response_redirect, **kwd ) + message='Error in adding selectfield option', + status='error', response_redirect=response_redirect, **kwd ) # add an empty option current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' ) return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) - def __remove_selectbox_option( self, trans, fd, msg, messagetype, response_redirect=None, **kwd ): + message=message, status=status, response_redirect=response_redirect, **kwd ) + def __remove_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ): ''' This method removes a selectbox option. The kwd dict searched for the field index and option index which needs to be removed @@ -336,12 +336,12 @@ if option == -1: # something wrong happened return self.__show( trans=trans, form=fd, current_form=current_form, - msg='Error in removing selectfield option', - messagetype='error', response_redirect=response_redirect, **kwd ) + message='Error in removing selectfield option', + status='error', response_redirect=response_redirect, **kwd ) # remove the option del current_form[ 'fields' ][ index ][ 'selectlist' ][ option ] return self.__show( trans=trans, form=fd, current_form=current_form, - msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd ) + message=message, status=status, response_redirect=response_redirect, **kwd ) def __get_field(self, index, **kwd): @@ -497,9 +497,9 @@ This method saves the current form ''' # check the form for invalid inputs - flag, msg = self.__validate_form(**kwd) + flag, message = self.__validate_form(**kwd) if not flag: - return None, msg + return None, message current_form = self.__get_form( trans, **kwd ) # validate fields for field in current_form[ 'fields' ]: @@ -523,8 +523,8 @@ fdc.latest_form = fd trans.sa_session.add( fdc ) trans.sa_session.flush() - msg = "The new form named '%s' has been created. " % (fd.name) - return fd, msg + message = "The new form named '%s' has been created. " % (fd.name) + return fd, message class FieldUI(object): def __init__(self, trans, layout_grids, index, field=None, field_type=None, form_type=None): @@ -631,7 +631,7 @@ def label(self): return str(self.index)+'.'+self.label - def __show( self, trans, form, current_form, msg='', messagetype='done', response_redirect=None, **kwd ): + def __show( self, trans, form, current_form, message='', status='done', response_redirect=None, **kwd ): ''' This method displays the form and any of the changes made to it, The empty_form param allows for this method to simulate clicking @@ -662,8 +662,8 @@ field_details=field_details, form=form, field_types=BaseField.form_field_types(), - msg=msg, - messagetype=messagetype, + message=message, + status=status, current_form_type=current_form[ 'type' ], layout_grids=form_layout, response_redirect=response_redirect ) diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/history.py Fri Apr 02 16:06:43 2010 -0400 @@ -648,8 +648,11 @@ elif 'unshare_user' in kwargs: user = trans.sa_session.query( trans.app.model.User ).get( trans.security.decode_id( kwargs[ 'unshare_user' ] ) ) if not user: - msg = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email ) - return trans.fill_template( 'history/sharing.mako', histories=histories, msg=msg, messagetype='error' ) + message = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email ) + return trans.fill_template( 'history/sharing.mako', + histories=histories, + message=message, + status='error' ) husas = trans.sa_session.query( trans.app.model.HistoryUserShareAssociation ).filter_by( user=user, history=history ).all() if husas: for husa in husas: diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/library.py --- a/lib/galaxy/web/controllers/library.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/library.py Fri Apr 02 16:06:43 2010 -0400 @@ -10,17 +10,17 @@ @web.expose def index( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) return trans.fill_template( "/library/index.mako", default_action=params.get( 'default_action', None ), - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def browse_libraries( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) current_user_roles = trans.get_current_user_roles() all_libraries = trans.sa_session.query( trans.app.model.Library ) \ .filter( trans.app.model.Library.table.c.deleted==False ) \ @@ -32,5 +32,5 @@ return trans.fill_template( '/library/browse_libraries.mako', libraries=authorized_libraries, default_action=params.get( 'default_action', None ), - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/library_admin.py --- a/lib/galaxy/web/controllers/library_admin.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/library_admin.py Fri Apr 02 16:06:43 2010 -0400 @@ -92,8 +92,8 @@ @web.require_admin def create_library( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) if params.get( 'create_library_button', False ): name = util.restore_text( params.get( 'name', 'No name' ) ) description = util.restore_text( params.get( 'description', '' ) ) @@ -105,14 +105,14 @@ library.root_folder = root_folder trans.sa_session.add_all( ( library, root_folder ) ) trans.sa_session.flush() - msg = "The new library named '%s' has been created" % library.name + message = "The new library named '%s' has been created" % library.name return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller='library_admin', id=trans.security.encode_id( library.id ), - msg=util.sanitize_text( msg ), - messagetype='done' ) ) - return trans.fill_template( '/admin/library/new_library.mako', msg=msg, messagetype=messagetype ) + message=util.sanitize_text( message ), + status='done' ) ) + return trans.fill_template( '/admin/library/new_library.mako', message=message, status=status ) @web.expose @web.require_admin def purge_library( self, trans, **kwd ): @@ -146,20 +146,20 @@ trans.sa_session.add( library_folder ) trans.sa_session.flush() if not library.deleted: - msg = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name ) + message = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name ) return trans.response.send_redirect( web.url_for( controller='library_admin', action='browse_libraries', - message=util.sanitize_text( msg ), + message=util.sanitize_text( message ), status='error' ) ) else: purge_folder( library.root_folder ) library.purged = True trans.sa_session.add( library ) trans.sa_session.flush() - msg = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name + message = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name return trans.response.send_redirect( web.url_for( controller='library_admin', action='browse_libraries', - message=util.sanitize_text( msg ), + message=util.sanitize_text( message ), status='done' ) ) @web.expose @web.require_admin @@ -176,8 +176,8 @@ 'folder': trans.app.model.LibraryFolder, 'library_dataset': trans.app.model.LibraryDataset } if item_type not in item_types: - msg = 'Bad item_type specified: %s' % str( item_type ) - messagetype = 'error' + message = 'Bad item_type specified: %s' % str( item_type ) + status = 'error' else: if item_type == 'library_dataset': item_desc = 'Dataset' @@ -187,18 +187,18 @@ library_item.deleted = True trans.sa_session.add( library_item ) trans.sa_session.flush() - msg = util.sanitize_text( "%s '%s' has been marked deleted" % ( item_desc, library_item.name ) ) - messagetype = 'done' + message = util.sanitize_text( "%s '%s' has been marked deleted" % ( item_desc, library_item.name ) ) + status = 'done' if item_type == 'library': - return self.browse_libraries( trans, message=msg, status=messagetype ) + return self.browse_libraries( trans, message=message, status=status ) else: return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller='library_admin', id=library_id, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) ) + message=message, + status=status ) ) @web.expose @web.require_admin def undelete_library_item( self, trans, library_id, item_id, item_type, **kwd ): @@ -208,7 +208,7 @@ 'folder': trans.app.model.LibraryFolder, 'library_dataset': trans.app.model.LibraryDataset } if item_type not in item_types: - msg = 'Bad item_type specified: %s' % str( item_type ) + message = 'Bad item_type specified: %s' % str( item_type ) status = ERROR else: if item_type == 'library_dataset': @@ -217,21 +217,21 @@ item_desc = item_type.capitalize() library_item = trans.sa_session.query( item_types[ item_type ] ).get( trans.security.decode_id( item_id ) ) if library_item.purged: - msg = '%s %s has been purged, so it cannot be undeleted' % ( item_desc, library_item.name ) + message = '%s %s has been purged, so it cannot be undeleted' % ( item_desc, library_item.name ) status = ERROR else: library_item.deleted = False trans.sa_session.add( library_item ) trans.sa_session.flush() - msg = util.sanitize_text( "%s '%s' has been marked undeleted" % ( item_desc, library_item.name ) ) + message = util.sanitize_text( "%s '%s' has been marked undeleted" % ( item_desc, library_item.name ) ) status = SUCCESS if item_type == 'library': - return self.browse_libraries( trans, message=msg, status=status ) + return self.browse_libraries( trans, message=message, status=status ) else: return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller='library_admin', id=library_id, show_deleted=show_deleted, - msg=msg, - messagetype=status ) ) + message=message, + status=status ) ) diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/library_common.py --- a/lib/galaxy/web/controllers/library_common.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/library_common.py Fri Apr 02 16:06:43 2010 -0400 @@ -79,18 +79,18 @@ @web.expose def browse_library( self, trans, cntrller, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) library_id = params.get( 'id', None ) if not library_id: # To handle bots - msg = "You must specify a library id." - messagetype = 'error' + message = "You must specify a library id." + status = 'error' library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) if not library: # To handle bots - msg = "Invalid library id ( %s )." % str( library_id ) - messagetype = 'error' + message = "Invalid library id ( %s )." % str( library_id ) + status = 'error' else: # If use_panels is True, the library is being accessed via an external link # which did not originate from within the Galaxy instance, and the library will @@ -100,12 +100,12 @@ created_ldda_ids = params.get( 'created_ldda_ids', '' ) hidden_folder_ids = util.listify( params.get( 'hidden_folder_ids', '' ) ) current_user_roles = trans.get_current_user_roles() - if created_ldda_ids and not msg: - msg = "%d datasets are uploading in the background to the library '%s' (each is selected). " % \ + if created_ldda_ids and not message: + message = "%d datasets are uploading in the background to the library '%s' (each is selected). " % \ ( len( created_ldda_ids.split( ',' ) ), library.name ) - msg += "Don't navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the " - msg += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset." - messagetype = "info" + message += "Don't navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the " + message += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset." + status = "info" return trans.fill_template( '/library/common/browse_library.mako', cntrller=cntrller, use_panels=use_panels, @@ -115,19 +115,19 @@ show_deleted=show_deleted, comptypes=comptypes, current_user_roles=current_user_roles, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) return trans.response.send_redirect( web.url_for( use_panels=use_panels, controller=cntrller, action='browse_libraries', default_action=params.get( 'default_action', None ), - msg=util.sanitize_text( msg ), - messagetype=messagetype ) ) + message=util.sanitize_text( message ), + status=status ) ) @web.expose def library_info( self, trans, cntrller, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) library_id = params.get( 'id', None ) library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) @@ -140,8 +140,8 @@ old_name = library.name new_name = util.restore_text( params.get( 'name', 'No name' ) ) if not new_name: - msg = 'Enter a valid name' - messagetype='error' + message = 'Enter a valid name' + status='error' else: new_description = util.restore_text( params.get( 'description', '' ) ) new_synopsis = util.restore_text( params.get( 'synopsis', '' ) ) @@ -155,15 +155,15 @@ library.root_folder.description = new_description trans.sa_session.add_all( ( library, library.root_folder ) ) trans.sa_session.flush() - msg = "The information has been updated." + message = "The information has been updated." return trans.response.send_redirect( web.url_for( controller='library_common', action='library_info', cntrller=cntrller, use_panels=use_panels, id=trans.security.encode_id( library.id ), show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) return trans.fill_template( '/library/common/library_info.mako', cntrller=cntrller, use_panels=use_panels, @@ -173,13 +173,13 @@ show_deleted=show_deleted, info_association=info_association, inherited=inherited, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def library_permissions( self, trans, cntrller, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) library_id = params.get( 'id', None ) library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) @@ -195,15 +195,15 @@ trans.sa_session.refresh( library ) # Copy the permissions to the root folder trans.app.security_agent.copy_library_permissions( library, library.root_folder ) - msg = "Permissions updated for library '%s'" % library.name + message = "Permissions updated for library '%s'" % library.name return trans.response.send_redirect( web.url_for( controller='library_common', action='library_permissions', cntrller=cntrller, use_panels=use_panels, id=trans.security.encode_id( library.id ), show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller ) return trans.fill_template( '/library/common/library_permissions.mako', cntrller=cntrller, @@ -212,26 +212,26 @@ current_user_roles=current_user_roles, roles=roles, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def create_folder( self, trans, cntrller, parent_id, library_id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) parent_folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( parent_id ) ) if not parent_folder: - msg = "Invalid parent folder id (%s) specified" % str( parent_id ) + message = "Invalid parent folder id (%s) specified" % str( parent_id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) if params.get( 'new_folder_button', False ): new_folder = trans.app.model.LibraryFolder( name=util.restore_text( params.name ), description=util.restore_text( params.description ) ) @@ -252,8 +252,8 @@ widgets = new_folder.get_template_widgets( trans ) if info_association: current_user_roles = trans.get_current_user_roles() - msg = "The new folder named '%s' has been added to the data library. " % new_folder.name - msg += "Additional information about this folder may be added using the inherited template." + message = "The new folder named '%s' has been added to the data library. " % new_folder.name + message += "Additional information about this folder may be added using the inherited template." return trans.fill_template( '/library/common/folder_info.mako', cntrller=cntrller, use_panels=use_panels, @@ -264,18 +264,18 @@ show_deleted=show_deleted, info_association=info_association, inherited=inherited, - msg=msg, - messagetype='done' ) + message=message, + status='done' ) # If not inheritable info_association, redirect to the library. - msg = "The new folder named '%s' has been added to the data library." % new_folder.name + message = "The new folder named '%s' has been added to the data library." % new_folder.name return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) # We do not render any template widgets on creation pages since saving the info_association # cannot occur before the associated item is saved. return trans.fill_template( '/library/common/new_folder.mako', @@ -284,13 +284,13 @@ library_id=library_id, folder=parent_folder, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def folder_info( self, trans, cntrller, id, library_id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( id ) ) @@ -306,18 +306,18 @@ new_name = util.restore_text( params.name ) new_description = util.restore_text( params.description ) if not new_name: - msg = 'Enter a valid name' - messagetype='error' + message = 'Enter a valid name' + status='error' else: folder.name = new_name folder.description = new_description trans.sa_session.add( folder ) trans.sa_session.flush() - msg = "The information has been updated." - messagetype='done' + message = "The information has been updated." + status='done' else: - msg = "You are not authorized to edit this folder" - messagetype='error' + message = "You are not authorized to edit this folder" + status='error' return trans.fill_template( '/library/common/folder_info.mako', cntrller=cntrller, use_panels=use_panels, @@ -328,26 +328,26 @@ show_deleted=show_deleted, info_association=info_association, inherited=inherited, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def folder_permissions( self, trans, cntrller, id, library_id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( id ) ) if not folder: - msg = "Invalid folder specified, id: %s" % str( id ) + message = "Invalid folder specified, id: %s" % str( id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) current_user_roles = trans.get_current_user_roles() if params.get( 'update_roles_button', False ): # The user clicked the Save button on the 'Associate With Roles' form @@ -361,11 +361,11 @@ permissions[ trans.app.security_agent.get_action( v.action ) ] = in_roles trans.app.security_agent.set_all_library_permissions( folder, permissions ) trans.sa_session.refresh( folder ) - msg = 'Permissions updated for folder %s' % folder.name - messagetype='done' + message = 'Permissions updated for folder %s' % folder.name + status='done' else: - msg = "You are not authorized to manage permissions on this folder" - messagetype = "error" + message = "You are not authorized to manage permissions on this folder" + status = "error" return trans.response.send_redirect( web.url_for( controller='library_common', action='folder_permissions', cntrller=cntrller, @@ -373,8 +373,8 @@ id=trans.security.encode_id( folder.id ), library_id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype=messagetype ) ) + message=util.sanitize_text( message ), + status=status ) ) # If the library is public all roles are legitimate, but if the library is restricted, only those # roles associated with the LIBRARY_ACCESS permission are legitimate. library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) @@ -387,26 +387,26 @@ current_user_roles=current_user_roles, roles=roles, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def ldda_edit_info( self, trans, cntrller, library_id, folder_id, id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) ) if not ldda: - msg = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id ) + message = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) dbkey = params.get( 'dbkey', '?' ) if isinstance( dbkey, list ): dbkey = dbkey[0] @@ -424,14 +424,14 @@ if ldda.datatype.allow_datatype_change and trans.app.datatypes_registry.get_datatype_by_extension( params.datatype ).allow_datatype_change: trans.app.datatypes_registry.change_datatype( ldda, params.datatype ) trans.sa_session.flush() - msg = "Data type changed for library dataset '%s'" % ldda.name - messagetype = 'done' + message = "Data type changed for library dataset '%s'" % ldda.name + status = 'done' else: - msg = "You are unable to change datatypes in this manner. Changing %s to %s is not allowed." % ( ldda.extension, params.datatype ) - messagetype = 'error' + message = "You are unable to change datatypes in this manner. Changing %s to %s is not allowed." % ( ldda.extension, params.datatype ) + status = 'error' else: - msg = "You are not authorized to change the data type of dataset '%s'" % ldda.name - messagetype = 'error' + message = "You are not authorized to change the data type of dataset '%s'" % ldda.name + status = 'error' elif params.get( 'save', False ): # The user clicked the Save button on the 'Edit Attributes' form if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ): @@ -440,8 +440,8 @@ new_info = util.restore_text( params.get( 'info', '' ) ) new_message = util.restore_text( params.get( 'message', '' ) ) if not new_name: - msg = 'Enter a valid name' - messagetype = 'error' + message = 'Enter a valid name' + status = 'error' else: ldda.name = new_name ldda.info = new_info @@ -459,11 +459,11 @@ ldda.metadata.dbkey = dbkey ldda.datatype.after_setting_metadata( ldda ) trans.sa_session.flush() - msg = 'Attributes updated for library dataset %s' % ldda.name - messagetype = 'done' + message = 'Attributes updated for library dataset %s' % ldda.name + status = 'done' else: - msg = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name - messagetype = 'error' + message = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name + status = 'error' elif params.get( 'detect', False ): # The user clicked the Auto-detect button on the 'Edit Attributes' form if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ): @@ -475,11 +475,11 @@ ldda.datatype.set_meta( ldda ) ldda.datatype.after_setting_metadata( ldda ) trans.sa_session.flush() - msg = 'Attributes updated for library dataset %s' % ldda.name - messagetype = 'done' + message = 'Attributes updated for library dataset %s' % ldda.name + status = 'done' else: - msg = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name - messagetype = 'error' + message = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name + status = 'error' if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ): if "dbkey" in ldda.datatype.metadata_spec and not ldda.metadata.dbkey: # Copy dbkey into metadata, for backwards compatability @@ -499,26 +499,26 @@ show_deleted=show_deleted, info_association=info_association, inherited=inherited, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def ldda_info( self, trans, cntrller, library_id, folder_id, id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) ) if not ldda: - msg = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id ) + message = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) # See if we have any associated templates widgets = [] @@ -536,13 +536,13 @@ current_user_roles=current_user_roles, info_association=info_association, inherited=inherited, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def ldda_permissions( self, trans, cntrller, library_id, folder_id, id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) ids = util.listify( id ) @@ -550,15 +550,15 @@ for id in [ trans.security.decode_id( id ) for id in ids ]: ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( id ) if ldda is None: - msg = 'You specified an invalid LibraryDatasetDatasetAssociation id: %s' %str( id ) + message = 'You specified an invalid LibraryDatasetDatasetAssociation id: %s' %str( id ) trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) lddas.append( ldda ) library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) # If access to the dataset is restricted, then use the roles associated with the DATASET_ACCESS permission to @@ -577,7 +577,7 @@ if cntrller=='library_admin' or ( trans.app.security_agent.can_manage_library_item( current_user_roles, ldda ) and \ trans.app.security_agent.can_manage_dataset( current_user_roles, ldda.dataset ) ): a = trans.app.security_agent.get_action( trans.app.security_agent.permitted_actions.DATASET_ACCESS.action ) - permissions, in_roles, error, msg = \ + permissions, in_roles, error, message = \ trans.app.security_agent.derive_roles_from_access( trans, trans.app.security.decode_id( library_id ), cntrller, library=True, **kwd ) for ldda in lddas: # Set the DATASET permissions on the Dataset. @@ -601,13 +601,13 @@ trans.app.security_agent.set_all_library_permissions( ldda, permissions ) trans.sa_session.refresh( ldda ) if error: - messagetype = 'error' + status = 'error' else: - msg = 'Permissions have been updated on %d datasets.' % len( lddas ) - messagetype= 'done' + message = 'Permissions have been updated on %d datasets.' % len( lddas ) + status= 'done' else: - msg = "You are not authorized to change the permissions of dataset '%s'" % ldda.name - messagetype = 'error' + message = "You are not authorized to change the permissions of dataset '%s'" % ldda.name + status = 'error' return trans.fill_template( "/library/common/ldda_permissions.mako", cntrller=cntrller, use_panels=use_panels, @@ -615,8 +615,8 @@ library_id=library_id, roles=roles, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) if len( ids ) > 1: # Ensure that the permissions across all library items are identical, otherwise we can't update them together. check_list = [] @@ -634,15 +634,15 @@ if not check_list: check_list = permissions if permissions != check_list: - msg = 'The datasets you selected do not have identical permissions, so they can not be updated together' + message = 'The datasets you selected do not have identical permissions, so they can not be updated together' trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) # Display permission form, permissions will be updated for all lddas simultaneously. return trans.fill_template( "/library/common/ldda_permissions.mako", cntrller=cntrller, @@ -651,13 +651,13 @@ library_id=library_id, roles=roles, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def upload_library_dataset( self, trans, cntrller, library_id, folder_id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) deleted = util.string_as_bool( params.get( 'deleted', False ) ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) dbkey = params.get( 'dbkey', '?' ) @@ -694,10 +694,10 @@ error = None if roles: vars = dict( DATASET_ACCESS_in=roles ) - permissions, in_roles, error, msg = \ + permissions, in_roles, error, message = \ trans.app.security_agent.derive_roles_from_access( trans, trans.app.security.decode_id( library_id ), cntrller, library=True, **vars ) if error: - messagetype = 'error' + status = 'error' trans.response.send_redirect( web.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, @@ -706,8 +706,8 @@ replace_id=replace_id, upload_option=upload_option, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) else: # See if we have any inherited templates, but do not inherit contents. @@ -731,16 +731,16 @@ ldda_id_list = [ str( v.id ) for k, v in created_outputs_dict.items() ] created_ldda_ids=",".join( ldda_id_list ) if replace_dataset: - msg = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset_name, folder.name ) + message = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset_name, folder.name ) else: if not folder.parent: # Libraries have the same name as their root_folder - msg = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name ) + message = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name ) else: - msg = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name ) + message = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name ) if cntrller == 'library_admin': - msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." - messagetype='done' + message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." + status='done' else: # Since permissions on all LibraryDatasetDatasetAssociations must be the same at this point, we only need # to check one of them to see if the current user can manage permissions on them. @@ -749,7 +749,7 @@ if replace_dataset: default_action = '' else: - msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." + message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." default_action = 'manage_permissions' else: default_action = 'add' @@ -760,21 +760,21 @@ default_action=default_action, created_ldda_ids=created_ldda_ids, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) else: created_ldda_ids = '' - msg = "Upload failed" - messagetype='error' + message = "Upload failed" + status='error' trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, created_ldda_ids=created_ldda_ids, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype=messagetype ) ) + message=util.sanitize_text( message ), + status=status ) ) # See if we have any inherited templates, but do not inherit contents. info_association, inherited = folder.get_info_association( inherited=True ) if info_association and info_association.inheritable: @@ -819,8 +819,8 @@ history=history, widgets=widgets, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_dataset=None, **kwd ): # Set up the traditional tool state/params tool_id = 'upload1' @@ -836,8 +836,8 @@ params = util.Params( kwd ) # is this filetoolparam safe? show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) library_bunch = upload_common.handle_library_params( trans, params, folder_id, replace_dataset ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) server_dir = util.restore_text( params.get( 'server_dir', '' ) ) if replace_dataset not in [ None, 'None' ]: replace_id = trans.security.encode_id( replace_dataset.id ) @@ -860,21 +860,21 @@ else: full_dir = os.path.join( import_dir, trans.user.email, server_dir ) if import_dir: - msg = 'Select a directory' + message = 'Select a directory' else: - msg = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc + message = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc # Proceed with (mostly) regular upload processing precreated_datasets = upload_common.get_precreated_datasets( trans, tool_params, trans.app.model.LibraryDatasetDatasetAssociation, controller=cntrller ) if upload_option == 'upload_file': tool_params = upload_common.persist_uploads( tool_params ) uploaded_datasets = upload_common.get_uploaded_datasets( trans, cntrller, tool_params, precreated_datasets, dataset_upload_inputs, library_bunch=library_bunch ) elif upload_option == 'upload_directory': - uploaded_datasets, err_redirect, msg = self.get_server_dir_uploaded_datasets( trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg ) + uploaded_datasets, err_redirect, message = self.get_server_dir_uploaded_datasets( trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, message ) elif upload_option == 'upload_paths': - uploaded_datasets, err_redirect, msg = self.get_path_paste_uploaded_datasets( trans, cntrller, params, library_bunch, err_redirect, msg ) + uploaded_datasets, err_redirect, message = self.get_path_paste_uploaded_datasets( trans, cntrller, params, library_bunch, err_redirect, message ) upload_common.cleanup_unused_precreated_datasets( precreated_datasets ) if upload_option == 'upload_file' and not uploaded_datasets: - msg = 'Select a file, enter a URL or enter text' + message = 'Select a file, enter a URL or enter text' err_redirect = True if err_redirect: trans.response.send_redirect( web.url_for( controller='library_common', @@ -885,8 +885,8 @@ replace_id=replace_id, upload_option=upload_option, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) json_file_path = upload_common.create_paramfile( trans, uploaded_datasets ) data_list = [ ud.data for ud in uploaded_datasets ] return upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder ) @@ -909,7 +909,7 @@ trans.sa_session.add( uploaded_dataset.data ) trans.sa_session.flush() return uploaded_dataset - def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg ): + def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, message ): files = [] try: for entry in os.listdir( full_dir ): @@ -925,23 +925,23 @@ if os.path.isfile( path ): files.append( path ) except Exception, e: - msg = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) ) + message = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) ) err_redirect = True - return None, err_redirect, msg + return None, err_redirect, message if not files: - msg = "The directory '%s' contains no valid files" % full_dir + message = "The directory '%s' contains no valid files" % full_dir err_redirect = True - return None, err_redirect, msg + return None, err_redirect, message uploaded_datasets = [] for file in files: name = os.path.basename( file ) uploaded_datasets.append( self.make_library_uploaded_dataset( trans, cntrller, params, name, file, 'server_dir', library_bunch ) ) return uploaded_datasets, None, None - def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, err_redirect, msg ): + def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, err_redirect, message ): if params.get( 'filesystem_paths', '' ) == '': - msg = "No paths entered in the upload form" + message = "No paths entered in the upload form" err_redirect = True - return None, err_redirect, msg + return None, err_redirect, message preserve_dirs = True if params.get( 'dont_preserve_dirs', False ): preserve_dirs = False @@ -974,16 +974,16 @@ library_bunch, in_folder ) ) if bad_paths: - msg = "Invalid paths:<br><ul><li>%s</li></ul>" % "</li><li>".join( bad_paths ) + message = "Invalid paths:<br><ul><li>%s</li></ul>" % "</li><li>".join( bad_paths ) err_redirect = True - return None, err_redirect, msg + return None, err_redirect, message return uploaded_datasets, None, None @web.expose def add_history_datasets_to_library( self, trans, cntrller, library_id, folder_id, hda_ids='', **kwd ): params = util.Params( kwd ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( folder_id ) ) replace_id = params.get( 'replace_id', None ) if replace_id: @@ -994,14 +994,14 @@ history = trans.get_history() trans.sa_session.refresh( history ) if not history.active_datasets: - msg = 'Your current history is empty' + message = 'Your current history is empty' return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) if params.get( 'add_history_datasets_to_library_button', False ): hda_ids = util.listify( hda_ids ) if hda_ids: @@ -1021,28 +1021,28 @@ # Permissions must be the same on the LibraryDatasetDatasetAssociation and the associated LibraryDataset trans.app.security_agent.copy_library_permissions( ldda.library_dataset, ldda ) else: - msg = "The requested HistoryDatasetAssociation id %s is invalid" % str( hda_id ) + message = "The requested HistoryDatasetAssociation id %s is invalid" % str( hda_id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) if created_ldda_ids: created_ldda_ids = created_ldda_ids.lstrip( ',' ) ldda_id_list = created_ldda_ids.split( ',' ) total_added = len( ldda_id_list ) if replace_dataset: - msg = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset.name, folder.name ) + message = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset.name, folder.name ) else: if not folder.parent: # Libraries have the same name as their root_folder - msg = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name ) + message = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name ) else: - msg = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name ) + message = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name ) if cntrller == 'library_admin': - msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." + message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." else: # Since permissions on all LibraryDatasetDatasetAssociations must be the same at this point, we only need # to check one of them to see if the current user can manage permissions on them. @@ -1052,7 +1052,7 @@ if replace_dataset: default_action = '' else: - msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." + message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary." default_action = 'manage_permissions' else: default_action = 'add' @@ -1062,11 +1062,11 @@ id=library_id, created_ldda_ids=created_ldda_ids, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) else: - msg = 'Select at least one dataset from the list of active datasets in your current history' - messagetype = 'error' + message = 'Select at least one dataset from the list of active datasets in your current history' + status = 'error' last_used_build = folder.genome_build upload_option = params.get( 'upload_option', 'import_from_history' ) # Send list of data formats to the form so the "extension" select list can be populated dynamically @@ -1091,8 +1091,8 @@ history=history, widgets=[], show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def download_dataset_from_folder( self, trans, cntrller, id, library_id=None, **kwd ): """Catches the dataset id and displays file contents as directed""" @@ -1101,8 +1101,8 @@ use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) ) if not ldda.dataset: - msg = 'Invalid LibraryDatasetDatasetAssociation id %s received for file download' % str( id ) - messagetype = 'error' + message = 'Invalid LibraryDatasetDatasetAssociation id %s received for file download' % str( id ) + status = 'error' else: composite_extensions = trans.app.datatypes_registry.get_composite_extensions( ) ext = ldda.extension @@ -1123,33 +1123,33 @@ try: return open( ldda.file_name ) except: - msg = 'This dataset contains no content' + message = 'This dataset contains no content' return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) @web.expose def library_dataset_info( self, trans, cntrller, id, library_id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) library_dataset = trans.sa_session.query( trans.app.model.LibraryDataset ).get( trans.security.decode_id( id ) ) if not library_dataset: - msg = "Invalid library dataset specified, id: %s" %str( id ) + message = "Invalid library dataset specified, id: %s" %str( id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) current_user_roles = trans.get_current_user_roles() # See if we have any associated templates widgets = [] @@ -1163,18 +1163,18 @@ new_name = util.restore_text( params.get( 'name', '' ) ) new_info = util.restore_text( params.get( 'info', '' ) ) if not new_name: - msg = 'Enter a valid name' - messagetype = 'error' + message = 'Enter a valid name' + status = 'error' else: library_dataset.name = new_name library_dataset.info = new_info trans.sa_session.add( library_dataset ) trans.sa_session.flush() - msg = "The information has been updated." - messagetype = 'done' + message = "The information has been updated." + status = 'done' else: - msg = "You are not authorized to change the attributes of this dataset" - messagetype = "error" + message = "You are not authorized to change the attributes of this dataset" + status = "error" return trans.fill_template( '/library/common/library_dataset_info.mako', cntrller=cntrller, use_panels=use_panels, @@ -1185,26 +1185,26 @@ inherited=inherited, widgets=widgets, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def library_dataset_permissions( self, trans, cntrller, id, library_id, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) library_dataset = trans.sa_session.query( trans.app.model.LibraryDataset ).get( id ) if not library_dataset: - msg = "Invalid library dataset specified, id: %s" %str( id ) + message = "Invalid library dataset specified, id: %s" %str( id ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) current_user_roles = trans.get_current_user_roles() if params.get( 'update_roles_button', False ): if cntrller == 'library_admin' or trans.app.security_agent.can_manage_library_item( current_user_roles, library_dataset ): @@ -1223,11 +1223,11 @@ # Set the LIBRARY permissions on the LibraryDatasetDatasetAssociation trans.app.security_agent.set_all_library_permissions( library_dataset.library_dataset_dataset_association, permissions ) trans.sa_session.refresh( library_dataset.library_dataset_dataset_association ) - msg = 'Permissions and roles have been updated for library dataset %s' % library_dataset.name - messagetype = 'done' + message = 'Permissions and roles have been updated for library dataset %s' % library_dataset.name + status = 'done' else: - msg = "You are not authorized to managed the permissions of this dataset" - messagetype = "error" + message = "You are not authorized to managed the permissions of this dataset" + status = "error" library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller ) return trans.fill_template( '/library/common/library_dataset_permissions.mako', @@ -1238,53 +1238,53 @@ roles=roles, current_user_roles=current_user_roles, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def act_on_multiple_datasets( self, trans, cntrller, library_id, ldda_ids='', **kwd ): # Perform an action on a list of library datasets. params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) action = params.get( 'do_action', None ) if not ldda_ids: - msg = "You must select at least one dataset" - messagetype = 'error' + message = "You must select at least one dataset" + status = 'error' elif not action: - msg = "You must select an action to perform on selected datasets" - messagetype = 'error' + message = "You must select an action to perform on selected datasets" + status = 'error' else: ldda_ids = util.listify( ldda_ids ) if action == 'import_to_history' or action == 'add': history = trans.get_history() if history is None: # Must be a bot sending a request without having a history. - msg = "You do not have a current history" + message = "You do not have a current history" return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) total_imported_lddas = 0 - msg = '' - messagetype = 'done' + message = '' + status = 'done' for ldda_id in ldda_ids: ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) ) if ldda.dataset.state in [ 'new', 'upload', 'queued', 'running', 'empty', 'discarded' ]: - msg += "Cannot import dataset (%s) since it's state is (%s). " % ( ldda.name, ldda.dataset.state ) - messagetype = 'error' + message += "Cannot import dataset (%s) since it's state is (%s). " % ( ldda.name, ldda.dataset.state ) + status = 'error' elif ldda.dataset.state in [ 'ok', 'error' ]: hda = ldda.to_history_dataset_association( target_history=history, add_to_history=True ) total_imported_lddas += 1 if total_imported_lddas: trans.sa_session.add( history ) trans.sa_session.flush() - msg += "%i dataset(s) have been imported into your history. " % total_imported_lddas + message += "%i dataset(s) have been imported into your history. " % total_imported_lddas elif action == 'manage_permissions': # We need the folder containing the LibraryDatasetDatasetAssociation(s) ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_ids[0] ) ) @@ -1296,8 +1296,8 @@ folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=",".join( ldda_ids ), show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype=messagetype ) ) + message=util.sanitize_text( message ), + status=status ) ) elif action == 'delete': for ldda_id in ldda_ids: ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) ) @@ -1307,7 +1307,7 @@ ld.deleted = True trans.sa_session.add( ld ) trans.sa_session.flush() - msg = "The selected datasets have been removed from this data library" + message = "The selected datasets have been removed from this data library" elif action in ['zip','tgz','tbz']: error = False killme = string.punctuation + string.whitespace @@ -1332,13 +1332,13 @@ except (OSError, zipfile.BadZipFile): error = True log.exception( "Unable to create archive for download" ) - msg = "Unable to create archive for download, please report this error" - messagetype = 'error' + message = "Unable to create archive for download, please report this error" + status = 'error' except: error = True log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[0]) - msg = "Unable to create archive for download, please report - %s" % sys.exc_info()[0] - messagetype = 'error' + message = "Unable to create archive for download, please report - %s" % sys.exc_info()[0] + status = 'error' if not error: composite_extensions = trans.app.datatypes_registry.get_composite_extensions( ) seen = [] @@ -1374,8 +1374,8 @@ except IOError: error = True log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name) - msg = "Unable to create archive for download, please report this error" - messagetype = 'error' + message = "Unable to create archive for download, please report this error" + status = 'error' continue flist = glob.glob(os.path.join(ldda.dataset.extra_files_path,'*.*')) # glob returns full paths for fpath in flist: @@ -1387,8 +1387,8 @@ except IOError: error = True log.exception( "Unable to add %s to temporary library download archive %s" % (fname,outfname)) - msg = "Unable to create archive for download, please report this error" - messagetype = 'error' + message = "Unable to create archive for download, please report this error" + status = 'error' continue else: # simple case try: @@ -1396,8 +1396,8 @@ except IOError: error = True log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name) - msg = "Unable to create archive for download, please report this error" - messagetype = 'error' + message = "Unable to create archive for download, please report this error" + status = 'error' if not error: if action == 'zip': archive.close() @@ -1409,8 +1409,8 @@ except OSError: error = True log.exception( "Unable to remove temporary library download archive and directory" ) - msg = "Unable to create archive for download, please report this error" - messagetype = 'error' + message = "Unable to create archive for download, please report this error" + status = 'error' if not error: trans.response.set_content_type( "application/x-zip-compressed" ) trans.response.headers[ "Content-Disposition" ] = "attachment; filename=%s.%s" % (outfname,outext) @@ -1422,7 +1422,7 @@ archive.wsgi_headeritems = trans.response.wsgi_headeritems() return archive.stream else: # unknown action - msg = '### unknown action = %s in act_on_multiple_datasets' % action + message = '### unknown action = %s in act_on_multiple_datasets' % action return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', @@ -1430,8 +1430,8 @@ use_panels=use_panels, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype=messagetype ) ) + message=util.sanitize_text( message ), + status=status ) ) def get_item_and_stuff( self, trans, item_type, library_id, folder_id, ldda_id ): # Return an item, description, action and an id based on the item_type. if item_type == 'library': @@ -1450,14 +1450,14 @@ action = 'ldda_edit_info' id = ldda_id else: - msg = "Invalid library item type ( %s )" % str( item_type ) + message = "Invalid library item type ( %s )" % str( item_type ) return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='error' ) ) + message=util.sanitize_text( message ), + status='error' ) ) return item, item_desc, action, id @web.expose def add_template( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ): @@ -1466,19 +1466,19 @@ filter=dict( deleted=False ), form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) if not forms: - msg = "There are no forms on which to base the template, so create a form and then add the template." + message = "There are no forms on which to base the template, so create a form and then add the template." trans.response.send_redirect( web.url_for( controller='forms', action='new', - msg=msg, - messagetype='done', + message=message, + status='done', form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) ) else: params = util.Params( kwd ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) - msg = util.restore_text( params.get( 'msg', '' ) ) + message = util.restore_text( params.get( 'message', '' ) ) action = '' - messagetype = params.get( 'messagetype', 'done' ) + status = params.get( 'status', 'done' ) item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id ) # If the inheritable checkbox is checked, the param will be in the request inheritable = CheckboxField.is_checked( params.get( 'inheritable', '' ) ) @@ -1497,7 +1497,7 @@ assoc = trans.app.model.LibraryDatasetDatasetInfoAssociation( item, form, form_values ) trans.sa_session.add( assoc ) trans.sa_session.flush() - msg = 'A template based on the form "%s" has been added to this %s.' % ( form.name, item_desc ) + message = 'A template based on the form "%s" has been added to this %s.' % ( form.name, item_desc ) trans.response.send_redirect( web.url_for( controller='library_common', action=action, cntrller=cntrller, @@ -1506,11 +1506,11 @@ folder_id=folder_id, id=id, show_deleted=show_deleted, - msg=msg, - messagetype='done' ) ) + message=message, + status='done' ) ) else: - msg = "Select a form on which to base the template." - messagetype = "error" + message = "Select a form on which to base the template." + status = "error" def generate_template_stuff( trans, forms, form_id ): # Returns the following: # - a list of template ids @@ -1555,22 +1555,22 @@ template_select_list=template_select_list, inheritable_checked=inheritable, show_deleted=show_deleted, - msg=msg, - messagetype=messagetype ) + message=message, + status=status ) @web.expose def manage_template_inheritance( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ): params = util.Params( kwd ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id ) info_association, inherited = item.get_info_association( restrict=True ) if info_association: if info_association.inheritable: - msg = "The template for this %s will no longer be inherited to contained folders and datasets." % item_desc + message = "The template for this %s will no longer be inherited to contained folders and datasets." % item_desc else: - msg = "The template for this %s will now be inherited to contained folders and datasets." % item_desc + message = "The template for this %s will now be inherited to contained folders and datasets." % item_desc info_association.inheritable = not( info_association.inheritable ) trans.sa_session.add( info_association ) trans.sa_session.flush() @@ -1582,16 +1582,16 @@ folder_id=folder_id, id=id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) @web.expose def edit_template( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, edited=False, **kwd ): # Edit the template itself, keeping existing field contents, if any. params = util.Params( kwd ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id ) # An info_association must exist at this point info_association, inherited = item.get_info_association( restrict=True ) @@ -1605,7 +1605,7 @@ info_association.template = fdc.latest_form trans.sa_session.add( info_association ) trans.sa_session.flush() - msg = "The template for this %s has been updated with your changes." % item_desc + message = "The template for this %s has been updated with your changes." % item_desc return trans.response.send_redirect( web.url_for( controller='library_common', action=action, cntrller=cntrller, @@ -1614,8 +1614,8 @@ folder_id=folder_id, id=id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) # "template" is a FormDefinition, so since we're changing it, we need to use the latest version of it. vars = dict( id=trans.security.encode_id( template.form_definition_current_id ), response_redirect=web.url_for( controller='library_common', @@ -1634,8 +1634,8 @@ params = util.Params( kwd ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id ) # Save updated template field contents field_contents = [] @@ -1681,7 +1681,7 @@ info_association = trans.app.model.LibraryDatasetDatasetInfoAssociation( item, template, form_values ) trans.sa_session.add( info_association ) trans.sa_session.flush() - msg = 'The information has been updated.' + message = 'The information has been updated.' return trans.response.send_redirect( web.url_for( controller='library_common', action=action, cntrller=cntrller, @@ -1690,8 +1690,8 @@ folder_id=folder_id, id=id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype='done' ) ) + message=util.sanitize_text( message ), + status='done' ) ) @web.expose def delete_template( self, trans, cntrller, item_type, library_id, id=None, folder_id=None, ldda_id=None, **kwd ): # Only adding a new template to a library or folder is currently allowed. Editing an existing template is @@ -1699,19 +1699,19 @@ params = util.Params( kwd ) show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) use_panels = util.string_as_bool( params.get( 'use_panels', False ) ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id ) info_association, inherited = item.get_info_association() if not info_association: - msg = "There is no template for this %s" % item_type - messagetype = 'error' + message = "There is no template for this %s" % item_type + status = 'error' else: info_association.deleted = True trans.sa_session.add( info_association ) trans.sa_session.flush() - msg = 'The template for this %s has been deleted.' % item_type - messagetype = 'done' + message = 'The template for this %s has been deleted.' % item_type + status = 'done' return trans.response.send_redirect( web.url_for( controller='library_common', action=action, cntrller=cntrller, @@ -1720,8 +1720,8 @@ folder_id=folder_id, id=id, show_deleted=show_deleted, - msg=util.sanitize_text( msg ), - messagetype=messagetype ) ) + message=util.sanitize_text( message ), + status=status ) ) # ---- Utility methods ------------------------------------------------------- diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/requests.py --- a/lib/galaxy/web/controllers/requests.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/requests.py Fri Apr 02 16:06:43 2010 -0400 @@ -164,7 +164,7 @@ elif operation == "events": return self.__request_events( trans, **kwd ) # if there are one or more requests that has been rejected by the admin - # recently, then show a msg as a reminder to the user + # recently, then show a message as a reminder to the user rlist = trans.sa_session.query( trans.app.model.Request ) \ .filter( trans.app.model.Request.table.c.deleted==False ) \ .filter( trans.app.model.Request.table.c.user_id==trans.user.id ) @@ -182,12 +182,12 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests', action='list', status='error', - message=msg, + message=message, **kwd) ) events_list = [] all_events = request.events @@ -238,8 +238,8 @@ return request_details def __show_request(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) add_sample = params.get('add_sample', False) try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) @@ -279,7 +279,7 @@ current_samples=current_samples, sample_copy=self.__copy_sample(current_samples), details='hide', edit_mode=util.restore_text( params.get( 'edit_mode', 'False' ) ), - msg=msg, messagetype=messagetype ) + message=message, status=status ) def __library_widgets(self, trans, user, sample_index, libraries, sample=None, **kwd): ''' This method creates the data library & folder selectbox for creating & @@ -424,8 +424,8 @@ @web.require_login( "create/submit sequencing requests" ) def show_request(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) ) except: @@ -503,28 +503,28 @@ edit_mode=edit_mode) elif params.get('save_samples_button', False) == 'Save': # check for duplicate sample names - msg = '' + message = '' for index in range(len(current_samples)-len(request.samples)): sample_index = index + len(request.samples) sample_name = current_samples[sample_index]['name'] if not sample_name.strip(): - msg = 'Please enter the name of sample number %i' % sample_index + message = 'Please enter the name of sample number %i' % sample_index break count = 0 for i in range(len(current_samples)): if sample_name == current_samples[i]['name']: count = count + 1 if count > 1: - msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name) + message = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name) break - if msg: + if message: return trans.fill_template( '/requests/show_request.mako', request=request, request_details=self.request_details(trans, request.id), current_samples = current_samples, sample_copy=self.__copy_sample(current_samples), details=details, edit_mode=edit_mode, - messagetype='error', msg=msg) + status='error', message=message) # save all the new/unsaved samples entered by the user if edit_mode == 'False': for index in range(len(current_samples)-len(request.samples)): @@ -542,18 +542,18 @@ trans.sa_session.add( s ) trans.sa_session.flush() else: - messagetype = 'done' - msg = 'Changes made to the sample(s) are saved. ' + status = 'done' + message = 'Changes made to the sample(s) are saved. ' for sample_index in range(len(current_samples)): sample = request.samples[sample_index] sample.name = current_samples[sample_index]['name'] sample.library = current_samples[sample_index]['library'] sample.folder = current_samples[sample_index]['folder'] if request.submitted(): - bc_msg = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode']) - if bc_msg: - messagetype = 'error' - msg += bc_msg + bc_message = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode']) + if bc_message: + status = 'error' + message += bc_message else: sample.bar_code = current_samples[sample_index]['barcode'] trans.sa_session.add( sample ) @@ -566,8 +566,8 @@ action='list', operation='show_request', id=trans.security.encode_id(request.id), - messagetype=messagetype, - msg=msg )) + status=status, + message=message )) elif params.get('edit_samples_button', False) == 'Edit samples': edit_mode = 'True' return trans.fill_template( '/requests/show_request.mako', @@ -589,15 +589,15 @@ current_samples=current_samples, sample_copy=self.__copy_sample(current_samples), details=details, libraries=libraries, - edit_mode=edit_mode, messagetype=messagetype, msg=msg) + edit_mode=edit_mode, status=status, message=message) @web.expose @web.require_login( "create/submit sequencing requests" ) def delete_sample(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', 0 ) ) ) current_samples, details, edit_mode = self.__update_samples( request, **kwd ) sample_index = int(params.get('sample_id', 0)) @@ -639,34 +639,34 @@ @web.require_login( "create/submit sequencing requests" ) def new(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) if params.get('select_request_type', False) == 'True': return trans.fill_template( '/requests/new_request.mako', select_request_type=self.__select_request_type(trans, 'none'), widgets=[], - msg=msg, - messagetype=messagetype) + message=message, + status=status) elif params.get('create', False) == 'True': if params.get('create_request_button', False) == 'Save' \ or params.get('create_request_samples_button', False) == 'Add samples': request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) ) if not util.restore_text(params.get('name', '')): - msg = 'Please enter the <b>Name</b> of the request' + message = 'Please enter the <b>Name</b> of the request' kwd['create'] = 'True' - kwd['messagetype'] = 'error' - kwd['msg'] = msg + kwd['status'] = 'error' + kwd['message'] = message kwd['create_request_button'] = None kwd['create_request_samples_button'] = None return trans.response.send_redirect( web.url_for( controller='requests', action='new', **kwd) ) request = self.__save_request(trans, None, **kwd) - msg = 'The new request named <b>%s</b> has been created' % request.name + message = 'The new request named <b>%s</b> has been created' % request.name if params.get('create_request_button', False) == 'Save': return trans.response.send_redirect( web.url_for( controller='requests', action='list', - message=msg , + message=message , status='done') ) elif params.get('create_request_samples_button', False) == 'Add samples': new_kwd = {} @@ -675,8 +675,8 @@ new_kwd['add_sample'] = True return trans.response.send_redirect( web.url_for( controller='requests', action='list', - msg=msg , - messagetype='done', + message=message , + status='done', **new_kwd) ) else: return self.__show_request_form(trans, **kwd) @@ -684,16 +684,16 @@ return self.__show_request_form(trans, **kwd) def __show_request_form(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) ) except: return trans.fill_template( '/requests/new_request.mako', select_request_type=self.__select_request_type(trans, 'none'), widgets=[], - msg=msg, - messagetype=messagetype) + message=message, + status=status) form_values = None select_request_type = self.__select_request_type(trans, request_type.id) # list of widgets to be rendered on the request form @@ -711,8 +711,8 @@ select_request_type=select_request_type, request_type=request_type, widgets=widgets, - msg=msg, - messagetype=messagetype) + message=message, + status=status) def __validate(self, trans, request): ''' Validates the request entered by the user @@ -723,14 +723,14 @@ if field['required'] == 'required' and request.values.content[index] in ['', None]: empty_fields.append(field['label']) if empty_fields: - msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name + message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name for ef in empty_fields: - msg = msg + '<b>' +ef + '</b><br/>' + message = message + '<b>' +ef + '</b><br/>' return trans.response.send_redirect( web.url_for( controller='requests', action='list', operation='edit', - messagetype = 'error', - msg=msg, + status = 'error', + message=message, id=trans.security.encode_id(request.id) )) # now check the required fields of all the samples of this request for s in request.samples: @@ -738,14 +738,14 @@ if field['required'] == 'required' and s.values.content[index] in ['', None]: empty_fields.append((s.name, field['label'])) if empty_fields: - msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name + message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name for sname, ef in empty_fields: - msg = msg + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname) + message = message + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname) return trans.response.send_redirect( web.url_for( controller='requests', action='list', operation='show_request', - messagetype = 'error', - msg=msg, + status = 'error', + message=message, id=trans.security.encode_id(request.id) )) def __save_request(self, trans, request=None, **kwd): ''' @@ -823,8 +823,8 @@ @web.require_login( "create/submit sequencing requests" ) def edit(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) ) except: @@ -839,19 +839,19 @@ or params.get('edit_samples_button', False) == 'Edit samples': request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) ) if not util.restore_text(params.get('name', '')): - msg = 'Please enter the <b>Name</b> of the request' - kwd['messagetype'] = 'error' - kwd['msg'] = msg + message = 'Please enter the <b>Name</b> of the request' + kwd['status'] = 'error' + kwd['message'] = message kwd['show'] = 'True' return trans.response.send_redirect( web.url_for( controller='requests', action='edit', **kwd) ) request = self.__save_request(trans, request, **kwd) - msg = 'The changes made to the request named %s has been saved' % request.name + message = 'The changes made to the request named %s has been saved' % request.name if params.get('save_changes_request_button', False) == 'Save changes': return trans.response.send_redirect( web.url_for( controller='requests', action='list', - message=msg , + message=message , status='done') ) elif params.get('edit_samples_button', False) == 'Edit samples': new_kwd = {} @@ -859,8 +859,8 @@ new_kwd['edit_samples_button'] = 'Edit samples' return trans.response.send_redirect( web.url_for( controller='requests', action='show_request', - msg=msg , - messagetype='done', + message=message , + status='done', **new_kwd) ) elif params.get('refresh', False) == 'true': return self.__edit_request(trans, id=trans.security.encode_id(request.id), **kwd) @@ -869,15 +869,15 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests', action='list', status='error', - message=msg) ) + message=message) ) params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) select_request_type = self.__select_request_type(trans, request.type.id) # list of widgets to be rendered on the request form widgets = [] @@ -901,8 +901,8 @@ request_type=request.type, request=request, widgets=widgets, - msg=msg, - messagetype=messagetype) + message=message, + status=status) return self.__show_request_form(trans) def __delete_request(self, trans, **kwd): id_list = util.listify( kwd['id'] ) @@ -911,12 +911,12 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests', action='list', status='error', - message=msg, + message=message, **kwd) ) # a request cannot be deleted once its submitted if not request.new(): @@ -926,28 +926,28 @@ trans.sa_session.add( request ) trans.sa_session.flush() if not len(delete_failed): - msg = '%i request(s) has been deleted.' % len(id_list) + message = '%i request(s) has been deleted.' % len(id_list) status = 'done' else: - msg = '%i request(s) has been deleted. %i request %s could not be deleted as they have been submitted.' % (len(id_list)-len(delete_failed), + message = '%i request(s) has been deleted. %i request %s could not be deleted as they have been submitted.' % (len(id_list)-len(delete_failed), len(delete_failed), str(delete_failed)) status = 'warning' return trans.response.send_redirect( web.url_for( controller='requests', action='list', status=status, - message=msg) ) + message=message) ) def __undelete_request(self, trans, **kwd): id_list = util.listify( kwd['id'] ) for id in id_list: try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests', action='list', status='error', - message=msg, + message=message, **kwd) ) request.deleted = False trans.sa_session.add( request ) @@ -960,12 +960,12 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests', action='list', status='error', - message=msg, + message=message, **kwd) ) # check if all the required request and its sample fields have been filled self.__validate(trans, request) @@ -994,11 +994,11 @@ sample_id = int(params.get('sample_id', False)) sample = trans.sa_session.query( trans.app.model.Sample ).get( sample_id ) except: - msg = "Invalid sample ID" + message = "Invalid sample ID" return trans.response.send_redirect( web.url_for( controller='requests', action='list', status='error', - message=msg, + message=message, **kwd) ) events_list = [] all_events = sample.events @@ -1015,8 +1015,8 @@ @web.require_login( "create/submit sequencing requests" ) def show_datatx_page( self, trans, **kwd ): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: sample = trans.sa_session.query( trans.app.model.Sample ).get( trans.security.decode_id( kwd['sample_id'] ) ) except: diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/requests_admin.py --- a/lib/galaxy/web/controllers/requests_admin.py Fri Apr 02 15:09:29 2010 -0400 +++ b/lib/galaxy/web/controllers/requests_admin.py Fri Apr 02 16:06:43 2010 -0400 @@ -289,8 +289,8 @@ @web.require_admin def edit(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) ) except: @@ -305,19 +305,19 @@ or params.get('edit_samples_button', False) == 'Edit samples': request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) ) if not util.restore_text(params.get('name', '')): - msg = 'Please enter the <b>Name</b> of the request' - kwd['messagetype'] = 'error' - kwd['msg'] = msg + message = 'Please enter the <b>Name</b> of the request' + kwd['status'] = 'error' + kwd['message'] = message kwd['show'] = 'True' return trans.response.send_redirect( web.url_for( controller='requests_admin', action='edit', **kwd) ) request = self.__save_request(trans, request, **kwd) - msg = 'The changes made to the request named %s has been saved' % request.name + message = 'The changes made to the request named %s has been saved' % request.name if params.get('save_changes_request_button', False) == 'Save changes': return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', - message=msg , + message=message , status='done') ) elif params.get('edit_samples_button', False) == 'Edit samples': new_kwd = {} @@ -325,8 +325,8 @@ new_kwd['edit_samples_button'] = 'Edit samples' return trans.response.send_redirect( web.url_for( controller='requests_admin', action='show_request', - msg=msg , - messagetype='done', + message=message , + status='done', **new_kwd) ) elif params.get('refresh', False) == 'true': return self.__edit_request(trans, id=trans.security.encode_id(request.id), **kwd) @@ -335,15 +335,15 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg) ) + message=message) ) params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) select_request_type = self.__select_request_type(trans, request.type.id) # list of widgets to be rendered on the request form widgets = [] @@ -367,8 +367,8 @@ request_type=request.type, request=request, widgets=widgets, - msg=msg, - messagetype=messagetype) + message=message, + status=status) return self.__show_request_form(trans) def __delete_request(self, trans, **kwd): id_list = util.listify( kwd['id'] ) @@ -376,34 +376,34 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg, + message=message, **kwd) ) request.deleted = True trans.sa_session.add( request ) trans.sa_session.flush() - msg = '%i request(s) has been deleted.' % len(id_list) + message = '%i request(s) has been deleted.' % len(id_list) status = 'done' return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status=status, - message=msg) ) + message=message) ) def __undelete_request(self, trans, **kwd): id_list = util.listify( kwd['id'] ) for id in id_list: try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg, + message=message, **kwd) ) request.deleted = False trans.sa_session.add( request ) @@ -416,20 +416,20 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg, + message=message, **kwd) ) - msg = self.__validate(trans, request) - if msg: + message = self.__validate(trans, request) + if message: return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', operation='edit', - messagetype = 'error', - msg=msg, + status = 'error', + message=message, id=trans.security.encode_id(request.id) ) ) # change the request state to 'Submitted' if request.user.email is not trans.user: @@ -456,12 +456,12 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg, + message=message, **kwd) ) return trans.fill_template( '/admin/requests/reject.mako', request=request) @@ -477,18 +477,18 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg, + message=message, **kwd) ) # validate if not params.get('comment', ''): return trans.fill_template( '/admin/requests/reject.mako', - request=request, messagetype='error', - msg='A comment is required for rejecting a request.') + request=request, status='error', + message='A comment is required for rejecting a request.') # create an event with state 'Rejected' for this request comments = util.restore_text( params.comment ) event = trans.app.model.RequestEvent(request, request.states.REJECTED, comments) @@ -503,12 +503,12 @@ try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) except: - msg = "Invalid request ID" - log.warn( msg ) + message = "Invalid request ID" + log.warn( message ) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', status='error', - message=msg, + message=message, **kwd) ) events_list = [] all_events = request.events @@ -547,35 +547,35 @@ @web.require_admin def new(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) if params.get('select_request_type', False) == 'True': return trans.fill_template( '/admin/requests/new_request.mako', select_request_type=self.__select_request_type(trans, 'none'), widgets=[], - msg=msg, - messagetype=messagetype) + message=message, + status=status) elif params.get('create', False) == 'True': if params.get('create_request_button', False) == 'Save' \ or params.get('create_request_samples_button', False) == 'Add samples': request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) ) if not util.restore_text(params.get('name', '')) \ or util.restore_text(params.get('select_user', '')) == unicode('none'): - msg = 'Please enter the <b>Name</b> of the request and the <b>user</b> on behalf of whom this request will be submitted before saving this request' + message = 'Please enter the <b>Name</b> of the request and the <b>user</b> on behalf of whom this request will be submitted before saving this request' kwd['create'] = 'True' - kwd['messagetype'] = 'error' - kwd['msg'] = msg + kwd['status'] = 'error' + kwd['message'] = message kwd['create_request_button'] = None kwd['create_request_samples_button'] = None return trans.response.send_redirect( web.url_for( controller='requests_admin', action='new', **kwd) ) request = self.__save_request(trans, None, **kwd) - msg = 'The new request named %s has been created' % request.name + message = 'The new request named %s has been created' % request.name if params.get('create_request_button', False) == 'Save': return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', - message=msg , + message=message , status='done') ) elif params.get('create_request_samples_button', False) == 'Add samples': new_kwd = {} @@ -584,7 +584,7 @@ new_kwd['add_sample'] = True return trans.response.send_redirect( web.url_for( controller='requests_admin', action='list', - message=msg , + message=message , status='done', **new_kwd) ) else: @@ -593,16 +593,16 @@ return self.__show_request_form(trans, **kwd) def __show_request_form(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) ) except: return trans.fill_template( '/admin/requests/new_request.mako', select_request_type=self.__select_request_type(trans, 'none'), widgets=[], - msg=msg, - messagetype=messagetype) + message=message, + status=status) form_values = None select_request_type = self.__select_request_type(trans, request_type.id) # user @@ -629,8 +629,8 @@ select_request_type=select_request_type, request_type=request_type, widgets=widgets, - msg=msg, - messagetype=messagetype) + message=message, + status=status) def __select_user(self, trans, userid): user_list = trans.sa_session.query( trans.app.model.User )\ .order_by( trans.app.model.User.email.asc() ) @@ -669,10 +669,10 @@ if field['required'] == 'required' and request.values.content[index] in ['', None]: empty_fields.append(field['label']) if empty_fields: - msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name + message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name for ef in empty_fields: - msg = msg + '<b>' +ef + '</b><br/>' - return msg + message = message + '<b>' +ef + '</b><br/>' + return message return None def __save_request(self, trans, request=None, **kwd): ''' @@ -746,8 +746,8 @@ # def __show_request(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) add_sample = params.get('add_sample', False) try: request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) ) @@ -787,7 +787,7 @@ current_samples=current_samples, sample_copy=self.__copy_sample(current_samples), details='hide', edit_mode=util.restore_text( params.get( 'edit_mode', 'False' ) ), - msg=msg, messagetype=messagetype ) + message=message, status=status ) def __library_widgets(self, trans, user, sample_index, libraries, sample=None, **kwd): ''' This method creates the data library & folder selectbox for creating & @@ -932,8 +932,8 @@ @web.require_login( "create/submit sequencing requests" ) def show_request(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) try: request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) ) except: @@ -1010,28 +1010,28 @@ edit_mode=edit_mode) elif params.get('save_samples_button', False) == 'Save': # check for duplicate sample names - msg = '' + message = '' for index in range(len(current_samples)-len(request.samples)): sample_index = index + len(request.samples) sample_name = current_samples[sample_index]['name'] if not sample_name.strip(): - msg = 'Please enter the name of sample number %i' % sample_index + message = 'Please enter the name of sample number %i' % sample_index break count = 0 for i in range(len(current_samples)): if sample_name == current_samples[i]['name']: count = count + 1 if count > 1: - msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name) + message = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name) break - if msg: + if message: return trans.fill_template( '/admin/requests/show_request.mako', request=request, request_details=self.request_details(trans, request.id), current_samples = current_samples, sample_copy=self.__copy_sample(current_samples), details=details, edit_mode=edit_mode, - messagetype='error', msg=msg) + status='error', message=message) # save all the new/unsaved samples entered by the user if edit_mode == 'False': for index in range(len(current_samples)-len(request.samples)): @@ -1050,18 +1050,18 @@ trans.sa_session.flush() else: - messagetype = 'done' - msg = 'Changes made to the sample(s) are saved. ' + status = 'done' + message = 'Changes made to the sample(s) are saved. ' for sample_index in range(len(current_samples)): sample = request.samples[sample_index] sample.name = current_samples[sample_index]['name'] sample.library = current_samples[sample_index]['library'] sample.folder = current_samples[sample_index]['folder'] if request.submitted(): - bc_msg = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode']) - if bc_msg: - messagetype = 'error' - msg += bc_msg + bc_message = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode']) + if bc_message: + status = 'error' + message += bc_message else: if not sample.bar_code: # if this is a 'new' (still in its first state) sample @@ -1083,8 +1083,8 @@ action='list', operation='show_request', id=trans.security.encode_id(request.id), - messagetype=messagetype, - msg=msg )) + status=status, + message=message )) elif params.get('edit_samples_button', False) == 'Edit samples': edit_mode = 'True' return trans.fill_template( '/admin/requests/show_request.mako', @@ -1106,15 +1106,15 @@ current_samples=current_samples, sample_copy=self.__copy_sample(current_samples), details=details, libraries=libraries, - edit_mode=edit_mode, messagetype=messagetype, msg=msg) + edit_mode=edit_mode, status=status, message=message) @web.expose @web.require_login( "create/submit sequencing requests" ) def delete_sample(self, trans, **kwd): params = util.Params( kwd ) - msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', 0 ) ) ) current_samples, details, edit_mode, libraries = self.__update_samples( trans, request, **kwd ) sample_index = int(params.get('sample_id', 0)) @@ -1182,11 +1182,11 @@ the given sample is gobally unique. That is, barcodes must be unique across requests in Galaxy LIMS ''' - msg = '' + message = '' for index in range(len(sample.request.samples)): # check for empty bar code if not barcode.strip(): - msg = 'Please fill the barcode for sample <b>%s</b>.' % sample.name + message = 'Please fill the barcode for sample <b>%s</b>.' % sample.name break # check all the saved bar codes all_samples = trans.sa_session.query( trans.app.model.Sample ) @@ -1195,20 +1195,20 @@