From bf638f2fe3ca6ec6388cd4bcd765e8b7cd8365c9 Mon Sep 17 00:00:00 2001 From: Krzysztof Ciba Date: Thu, 15 Mar 2012 13:45:27 +0100 Subject: [PATCH] RM: fix in types check for lfn param, StorageElement: making default argDict a dict, Transformation: typo in arg name --- DataManagementSystem/Client/ReplicaManager.py | 10 +++++----- Resources/Storage/StorageElement.py | 5 ++++- TransformationSystem/Client/Transformation.py | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/DataManagementSystem/Client/ReplicaManager.py b/DataManagementSystem/Client/ReplicaManager.py index adc799dc621..185e66e22b9 100644 --- a/DataManagementSystem/Client/ReplicaManager.py +++ b/DataManagementSystem/Client/ReplicaManager.py @@ -63,7 +63,7 @@ def _callFileCatalogFcnSingleFile( self, lfn, method, argsDict=None, catalogs=No argsDict = argsDict if argsDict else dict() catalogs = catalogs if catalogs else list() ## checjk type - if not lfn or type(lfn) not in ( ListType, StringTypes, DictType ): + if not lfn or type(lfn) not in StringTypes + ( ListType, DictType ): return S_ERROR( "wrong type (%s) for argument 'lfn'" % type(lfn) ) singleLfn = lfn if type( lfn ) == ListType: @@ -96,7 +96,7 @@ def _callFileCatalogFcn( self, lfn, method, argsDict = None, catalogs = None ): argsDict = argsDict if argsDict else dict() catalogs = catalogs if catalogs else list() lfns = None - if not lfn or type(lfn) not in ( StringTypes, ListType, DictType ): + if not lfn or type(lfn) not in StringTypes + ( ListType, DictType ): errStr = "ReplicaManager._callFileCatalogFcn: Wrong 'lfn' argument." gLogger.error( errStr ) return S_ERROR( errStr ) @@ -462,7 +462,7 @@ def _callStorageElementFcnSingleFile( self, storageElementName, pfn, method, arg :param str method: name of the :StorageElement: method to be invoked :param dict argsDict: additional keyword arguments that are required for the :method: """ - argsDict = argsDict if argsDict else dict() + argsDict = argsDict if argsDict else {} ## check type if type( pfn ) == ListType: pfn = pfn[0] @@ -866,7 +866,7 @@ def _callReplicaSEFcnSingleFile( self, storageElementName, lfn, method, argsDict :param dict argsDict: kwargs of :method: """ ## default value - argsDict = argsDict if argsDict else dict() + argsDict = argsDict if argsDict else {} ## get single LFN singleLfn = lfn if type( lfn ) == ListType: @@ -890,7 +890,7 @@ def _callReplicaSEFcn( self, storageElementName, lfn, method, argsDict=None ): :param mixed lfn: a LFN str, list of LFNs or dict with LFNs as keys """ ## default value - argsDict = argsDict if argsDict else dict() + argsDict = argsDict if argsDict else {} ## get replicas for lfn res = self._callFileCatalogFcn( lfn, "getReplicas" ) if not res["OK"]: diff --git a/Resources/Storage/StorageElement.py b/Resources/Storage/StorageElement.py index 6f1f67cb2a1..8715050eb67 100755 --- a/Resources/Storage/StorageElement.py +++ b/Resources/Storage/StorageElement.py @@ -116,7 +116,8 @@ def getStatus( self ): - Read: True (is allowed), False (it is not allowed) - Write: True (is allowed), False (it is not allowed) - Remove: True (is allowed), False (it is not allowed) - - Check: True (is allowed), False (it is not allowed). NB: Check always allowed IF Read is allowed (regardless of what set in the Check option of the configuration) + - Check: True (is allowed), False (it is not allowed). + NB: Check always allowed IF Read is allowed (regardless of what set in the Check option of the configuration) - DiskSE: True if TXDY with Y > 0 (defaults to True) - TapeSE: True if TXDY with X > 0 (defaults to False) - TotalCapacityTB: float (-1 if not defined) @@ -551,6 +552,8 @@ def __executeFunction( self, pfn, method, argsDict = None ): 'pfn' is the physical file name (as registered in the LFC) 'method' is the functionality to be executed """ + ## default args = no args + argsDict = argsDict if argsDict else {} if type( pfn ) in types.StringTypes: pfns = {pfn:False} elif type( pfn ) == types.ListType: diff --git a/TransformationSystem/Client/Transformation.py b/TransformationSystem/Client/Transformation.py index cdf60fa5b97..69076510829 100644 --- a/TransformationSystem/Client/Transformation.py +++ b/TransformationSystem/Client/Transformation.py @@ -232,7 +232,7 @@ def __executeOperation( self, operation, *parms, **kwds ): fcn = getattr( self.transClient, operation ) if not fcn: return S_ERROR("Unable to invoke %s, it isn't a member funtion of TransformationClient" ) - res = fcn( transID, *param, **kwds ) + res = fcn( transID, *parms, **kwds ) if printOutput: self._prettyPrint( res ) return res