commit/galaxy-central: dan: Add __non_zero__ method to ToolParameterValueWrappers. Resolves #661.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/25f3c2c08e97/ changeset: 25f3c2c08e97 user: dan date: 2011-12-09 17:10:44 summary: Add __non_zero__ method to ToolParameterValueWrappers. Resolves #661. affected #: 1 file diff -r 8718607f7ae5554b6a43caff974a4949eb504950 -r 25f3c2c08e97dc2b8d5ea2885d5083b887c65fba lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2141,7 +2141,14 @@ def __init__( self, value ): self.value = value -class RawObjectWrapper( object ): +class ToolParameterValueWrapper( object ): + """ + Base class for object that Wraps a Tool Parameter and Value. + """ + def __nonzero__( self ): + return bool( self.value ) + +class RawObjectWrapper( ToolParameterValueWrapper ): """ Wraps an object so that __str__ returns module_name:class_name. """ @@ -2152,7 +2159,7 @@ def __getattr__( self, key ): return getattr( self.obj, key ) -class LibraryDatasetValueWrapper( object ): +class LibraryDatasetValueWrapper( ToolParameterValueWrapper ): """ Wraps an input so that __str__ gives the "param_dict" representation. """ @@ -2173,7 +2180,7 @@ def __getattr__( self, key ): return getattr( self.value, key ) -class InputValueWrapper( object ): +class InputValueWrapper( ToolParameterValueWrapper ): """ Wraps an input so that __str__ gives the "param_dict" representation. """ @@ -2186,7 +2193,7 @@ def __getattr__( self, key ): return getattr( self.value, key ) -class SelectToolParameterWrapper( object ): +class SelectToolParameterWrapper( ToolParameterValueWrapper ): """ Wraps a SelectTooParameter so that __str__ returns the selected value, but all other attributes are accessible. @@ -2218,7 +2225,7 @@ def __getattr__( self, key ): return getattr( self.input, key ) -class DatasetFilenameWrapper( object ): +class DatasetFilenameWrapper( ToolParameterValueWrapper ): """ Wraps a dataset so that __str__ returns the filename, but all other attributes are accessible. @@ -2278,6 +2285,9 @@ return self.false_path else: return getattr( self.dataset, key ) + + def __nonzero__( self ): + return bool( self.dataset ) def json_fix( val ): if isinstance( val, list ): 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