commit/galaxy-central: jmchilton: Small refactor to ToolDataParameter.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/99f5d55b02a2/ Changeset: 99f5d55b02a2 User: jmchilton Date: 2014-01-20 19:39:50 Summary: Small refactor to ToolDataParameter. Break out logic for computing and asserting existence of history - simplifies get_html_field, get_initial_value_from_history_prevent_repeat, reduces code duplication, and eases some downstream merges changes I making. Affected #: 1 file diff -r b3171af94dccffaa6e8a5b9b8bda1fd39479643c -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1611,9 +1611,7 @@ filter_value = self.options.get_options( trans, other_values )[0][0] except IndexError: pass # no valid options - assert trans is not None, "DataToolParameter requires a trans" - history = trans.get_history() - assert history is not None, "DataToolParameter requires a history" + history = self._get_history( trans ) if value is not None: if type( value ) != list: value = [ value ] @@ -1683,10 +1681,7 @@ # Can't look at history in workflow mode. Tool shed has no histories. if trans is None or trans.workflow_building_mode or trans.webapp.name == 'tool_shed': return DummyDataset() - assert trans is not None, "DataToolParameter requires a trans" - if history is None: - history = trans.get_history() - assert history is not None, "DataToolParameter requires a history" + history = self._get_history( trans, history ) if self.optional: return None most_recent_dataset = [] @@ -1860,6 +1855,14 @@ ref = ref() return ref + def _get_history( self, trans, history=None ): + class_name = self.__class__.__name__ + assert trans is not None, "%s requires a trans" % class_name + if history is None: + history = trans.get_history() + assert history is not None, "%s requires a history" % class_name + return history + class HiddenDataToolParameter( HiddenToolParameter, DataToolParameter ): """ 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)
-
commits-noreply@bitbucket.org