commit/galaxy-central: rc: Backed out of changeset 5085:0ce482e2ec78
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/0320a5b0d1a7/ changeset: r5086:0320a5b0d1a7 user: rc date: 2011-02-18 17:18:52 summary: Backed out of changeset 5085:0ce482e2ec78 affected #: 1 file (244 bytes) --- a/lib/galaxy/web/controllers/requests_common.py Fri Feb 18 10:49:46 2011 -0500 +++ b/lib/galaxy/web/controllers/requests_common.py Fri Feb 18 11:18:52 2011 -0500 @@ -445,7 +445,6 @@ kwd[ 'message' ] = message handle_error( **kwd ) if params.get( 'save_samples_button', False ): - samples = [] if encoded_selected_sample_ids: # We need the list of displayable_sample_widgets to include the same number # of objects that that request.samples has so that we can enumerate over each @@ -453,6 +452,7 @@ # used the multi-select check boxes when editing sample widgets, but didn't # select all of them. We'll first get the set of samples corresponding to the # checked sample ids. + samples = [] selected_samples = [] for encoded_sample_id in encoded_selected_sample_ids: sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( encoded_sample_id ) ) @@ -467,7 +467,7 @@ sample_widgets = self.__get_sample_widgets( trans, request, samples, **kwd ) else: sample_widgets = displayable_sample_widgets - return self.__save_samples( trans, cntrller, request, samples, sample_widgets, saving_new_samples=False, **kwd ) + return self.__save_samples( trans, cntrller, request, sample_widgets, saving_new_samples=False, **kwd ) request_widgets = self.__get_request_widgets( trans, request.id ) sample_copy_select_field = self.__build_copy_sample_select_field( trans, displayable_sample_widgets ) libraries_select_field, folders_select_field = self.__build_library_and_folder_select_fields( trans, @@ -806,8 +806,7 @@ elif params.get( 'add_sample_button', False ): return self.add_sample( trans, cntrller, request_id, **kwd ) elif params.get( 'save_samples_button', False ): - samples = [] - return self.__save_samples( trans, cntrller, request, samples, displayable_sample_widgets, saving_new_samples=True, **kwd ) + return self.__save_samples( trans, cntrller, request, displayable_sample_widgets, saving_new_samples=True, **kwd ) request_widgets = self.__get_request_widgets( trans, request.id ) sample_copy_select_field = self.__build_copy_sample_select_field( trans, displayable_sample_widgets ) libraries_select_field, folders_select_field = self.__build_library_and_folder_select_fields( trans, @@ -1084,7 +1083,7 @@ request_widgets=request_widgets, displayable_sample_widgets=displayable_sample_widgets, sample_copy_select_field=sample_copy_select_field ) - def __save_samples( self, trans, cntrller, request, samples, sample_widgets, saving_new_samples=False, **kwd ): + def __save_samples( self, trans, cntrller, request, samples, saving_new_samples=False, **kwd ): # Here we handle saving all new samples added by the user as well as saving # changes to any subset of the request's samples. A sample will not have an # associated SampleState until the request is submitted, at which time the @@ -1100,7 +1099,7 @@ else: redirect_action = 'edit_samples' # Check for duplicate sample names within the request - self.__validate_sample_names( trans, cntrller, request, sample_widgets, **kwd ) + self.__validate_sample_names( trans, cntrller, request, samples, **kwd ) if not saving_new_samples: library = None folder = None @@ -1129,16 +1128,17 @@ # TODO: make changes necessary to just send the samples... encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd ) # Make sure all samples have a unique bar_code if the state is changing - for sample_index, sample in enumerate( samples ): - if sample is None: + for sample_index in range( len( samples ) ): + current_sample = samples[ sample_index ] + if current_sample is None: # We have a None value because the user did not select this sample # on which to perform the action. continue - current_sample = sample_widgets[ sample_index ] + request_sample = request.samples[ sample_index ] bar_code = current_sample[ 'bar_code' ] if bar_code: # If the sample has a new bar_code, make sure it is unique. - bc_message = self.__validate_bar_code( trans, sample, bar_code ) + bc_message = self.__validate_bar_code( trans, request_sample, bar_code ) if bc_message: message += bc_message kwd[ 'message' ] = message @@ -1153,15 +1153,11 @@ library_id = params.get( 'sample_operation_library_id', 'none' ) folder_id = params.get( 'sample_operation_folder_id', 'none' ) library, folder = self.__get_library_and_folder( trans, library_id, folder_id ) - for sample_index, sample in enumerate( samples ): - if sample is None: - # We have a None value because the user did not select this sample - # on which to perform the action. - continue - current_sample = sample_widgets[ sample_index ] + for sample_index in range( len( samples ) ): + current_sample = samples[ sample_index ] current_sample[ 'library' ] = library current_sample[ 'folder' ] = folder - self.__update_samples( trans, cntrller, request, sample_widgets, **kwd ) + self.__update_samples( trans, cntrller, request, samples, **kwd ) message = 'Changes made to the samples have been saved. ' else: # Saving a newly created sample. The sample will not have an associated SampleState @@ -1169,9 +1165,9 @@ # set to the first SampleState configured for the request's RequestType configured # by the admin ( i.e., the sample's SampleState would be set to request.type.states[0] ). new_samples = [] - for index in range( len( sample_widgets ) - len( request.samples ) ): + for index in range( len( samples ) - len( request.samples ) ): sample_index = len( request.samples ) - sample_widget = sample_widgets[ sample_index ] + sample_widget = samples[ sample_index ] form_values = trans.model.FormValues( request.type.sample_form, sample_widget[ 'field_values' ] ) trans.sa_session.add( form_values ) trans.sa_session.flush() Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket