commit/galaxy-central: jmchilton: Merged in jmchilton/galaxy-central-fork-1 (pull request #575)
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/171511af9fcf/ Changeset: 171511af9fcf User: jmchilton Date: 2014-12-04 14:50:45+00:00 Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #575) Allow using attribute 'optional' for data column parameters. Affected #: 2 files diff -r 100a7353b7faf9815783ec7f1245bb539a1b2717 -r 171511af9fcf2689e2761cf79e2cf02ff8324acc lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1130,7 +1130,13 @@ SelectToolParameter.__init__( self, tool, elem ) self.tool = tool self.numerical = string_as_bool( elem.get( "numerical", False )) - self.force_select = string_as_bool( elem.get( "force_select", True )) + # Allow specifing force_select for backward compat., but probably + # should use optional going forward for consistency with other + # parameters. + if "force_select" in elem.attrib: + self.force_select = string_as_bool( elem.get( "force_select" ) ) + else: + self.force_select = not string_as_bool( elem.get( "optional", False ) ) self.accept_default = string_as_bool( elem.get( "accept_default", False )) self.data_ref = elem.get( "data_ref", None ) self.ref_input = None diff -r 100a7353b7faf9815783ec7f1245bb539a1b2717 -r 171511af9fcf2689e2761cf79e2cf02ff8324acc test/unit/tools/test_column_parameters.py --- a/test/unit/tools/test_column_parameters.py +++ b/test/unit/tools/test_column_parameters.py @@ -13,6 +13,21 @@ class DataColumnParameterTestCase( TestCase, tools_support.UsesApp ): + def test_not_optional_by_default(self): + assert not self.__param_optional() + + def test_force_select_disable(self): + self.other_attributes = 'force_select="false"' + assert self.__param_optional() + + def test_optional_override(self): + self.other_attributes = 'optional="true"' + assert self.__param_optional() + + def __param_optional(self): + # TODO: don't break abstraction, try setting null value instead + return not self.param.force_select + def test_from_html(self): value = self.param.from_html("3", self.trans, { "input_tsv": self.build_ready_hda() } ) assert value == "3" 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