[hg] galaxy 2473: Fixed a bug in form editing where some charact...
details: http://www.bx.psu.edu/hg/galaxy/rev/f7bdfd409b7d changeset: 2473:f7bdfd409b7d user: rc date: Fri Jul 10 14:50:17 2009 -0400 description: Fixed a bug in form editing where some characters where not appearing correctly when the form is saved. 3 file(s) affected in this change: lib/galaxy/web/controllers/admin.py lib/galaxy/web/controllers/forms.py lib/galaxy/web/controllers/requests.py diffs (98 lines): diff -r 249f0037dea2 -r f7bdfd409b7d lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py Fri Jul 10 13:52:20 2009 -0400 +++ b/lib/galaxy/web/controllers/admin.py Fri Jul 10 14:50:17 2009 -0400 @@ -2188,10 +2188,10 @@ msg=msg, messagetype=messagetype ) def _save_request_type(self, trans, params, request_type_id): - num_states = int( params.get( 'num_states', 0 ) ) + num_states = int( util.restore_text( params.get( 'num_states', 0 ) )) proceed = True for i in range( num_states ): - if not params.get( 'new_element_name_%i' % i, None ): + if not util.restore_text( params.get( 'new_element_name_%i' % i, None ) ): proceed = False break if not proceed: @@ -2212,8 +2212,8 @@ ss.delete() ss.flush() for i in range( num_states ): - name = params.get( 'new_element_name_%i' % i, None ) - desc = params.get( 'new_element_description_%i' % i, None ) + name = util.restore_text( params.get( 'new_element_name_%i' % i, None )) + desc = util.restore_text( params.get( 'new_element_description_%i' % i, None )) ss = trans.app.model.SampleState(name, desc, rt.id) ss.flush() msg = "The new sample type named '%s' with %s state(s) has been created" % (rt.name, num_states) diff -r 249f0037dea2 -r f7bdfd409b7d lib/galaxy/web/controllers/forms.py --- a/lib/galaxy/web/controllers/forms.py Fri Jul 10 13:52:20 2009 -0400 +++ b/lib/galaxy/web/controllers/forms.py Fri Jul 10 14:50:17 2009 -0400 @@ -150,10 +150,10 @@ 'selectlist': '' } self.current_form['fields'].append(empty_field) def __get_field(self, params, index): - name = params.get( 'field_name_%i' % index, None ) - helptext = params.get( 'field_helptext_%i' % index, None ) - required = params.get( 'field_required_%i' % index, False ) - field_type = params.get( 'field_type_%i' % index, None ) + name = util.restore_text( params.get( 'field_name_%i' % index, None ) ) + helptext = util.restore_text( params.get( 'field_helptext_%i' % index, None ) ) + required = util.restore_text( params.get( 'field_required_%i' % index, False ) ) + field_type = util.restore_text( params.get( 'field_type_%i' % index, None ) ) if field_type == 'SelectField': selectlist = self.__get_selectbox_options(params, index) else: @@ -172,7 +172,7 @@ ctr=0 sb_options = [] while True: - option = params.get( 'field_'+str(index)+'_option_'+str(ctr), None ) + option = util.restore_text( params.get( 'field_'+str(index)+'_option_'+str(ctr), None ) ) ctr = ctr+1 if option: sb_options.append(option) @@ -194,7 +194,7 @@ return None, 'Form name must be filled.' # fields for i in range( len(self.current_form['fields']) ): - if not params.get( 'field_name_%i' % i, None ): + if not util.restore_text(params.get( 'field_name_%i' % i, None )): return None, "All the field label(s) must be completed." return True, '' def __get_form(self, params): diff -r 249f0037dea2 -r f7bdfd409b7d lib/galaxy/web/controllers/requests.py --- a/lib/galaxy/web/controllers/requests.py Fri Jul 10 13:52:20 2009 -0400 +++ b/lib/galaxy/web/controllers/requests.py Fri Jul 10 14:50:17 2009 -0400 @@ -212,12 +212,12 @@ request = trans.app.model.Request.get(request_id) form_values = trans.app.model.FormValues.get(request.form_values_id) request_form = trans.app.model.FormDefinition.get(form_values.request_form_id) - name = params.get('name', '') - desc = params.get('desc', '') - library_id = params.get('library', '') + name = util.restore_text(params.get('name', '')) + desc = util.restore_text(params.get('desc', '')) + library_id = util.restore_text(params.get('library', '')) values = {} for field in request_form.fields: - values[field['label']] = params.get(field['label'], '') + values[field['label']] = util.restore_text(params.get(field['label'], '')) if not request_id: form_values = trans.app.model.FormValues(request_form_id, values) form_values.flush() @@ -348,11 +348,11 @@ sample = trans.app.model.Sample.get(sample_id) form_data = trans.app.model.FormData.get(sample.form_data_id) form = trans.app.model.FormDefinition.get(form_data.form_definition_id) - name = params.get('name', '') - desc = params.get('desc', '') + name = util.restore_text(params.get('name', '')) + desc = util.restore_text(params.get('desc', '')) values = {} for field in sample_form.fields: - values[field['label']] = params.get(field['label'], '') + values[field['label']] = util.restore_text(params.get(field['label'], '')) if not sample_id: form_values = trans.app.model.FormValues(sample_form.id, values) form_values.flush()
participants (1)
-
Greg Von Kuster