Commit b2354308 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Return result as dictionary instead of list in 'getOSPath()' method.

parent 5f6a140e
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ class DbConnector(object):
            try:
                cursor = conn.cursor(cursor_factory = RealDictCursor)
                cursor.execute("""
                    SELECT storage_type, base_path, user_name, tstamp_wrapper_dir, os_path
                    SELECT storage_type, base_path, user_name, tstamp_wrapper_dir, os_path, content_length
                    FROM node_path p
                    JOIN node n ON p.node_id = n.node_id
                    JOIN location l ON n.location_id = l.location_id
@@ -93,11 +93,19 @@ class DbConnector(object):
        userName = result[0]["user_name"]
        tstampWrappedDir = result[0]["tstamp_wrapper_dir"]
        osPath = result[0]["os_path"]
        contentLength = result[0]["content_length"]
        if tstampWrappedDir is None:
            fullPath = basePath + "/" + userName + osPath
        else:
            fullPath = basePath + "/" + userName + "/" + tstampWrappedDir + osPath
        return [ fullPath, storageType, userName, osPath ]
        fileInfo = { 
                       "fullPath": fullPath, 
                       "storageType": storageType, 
                       "username": userName, 
                       "osPath": osPath,
                       "contentLength": contentLength
                   }
        return fileInfo

    def getVOSpacePathList(self, vospacePath):
        """Returns the list of VOSpace paths carried by a VOSpace node, according to the node VOSpace path."""