Esempio n. 1
0
    def __init__(self):
        self.__extVersion = SessionData.getExtJSVersion()
        self.__staticPaths = HandlerMgr().getPaths("static")
        self.__extensions = getInstalledExtensions()
        self.__webAppPath = os.path.dirname(self.__staticPaths[-1])
        self.__extPath = os.path.join(self.__webAppPath, "static", "extjs",
                                      self.__extVersion)
        self.__sdkPath = os.path.join(self.__webAppPath, "static", "extjs",
                                      self.__extVersion, "src")
        self.__appDependency = CompilerHelper().getAppDependencies()

        self.__classPaths = [
            os.path.join(self.__webAppPath, *p)
            for p in (("static", "core", "js", "utils"), ("static", "core",
                                                          "js", "core"))
        ]
        self.__classPaths.append(
            os.path.join(self.__extPath, "examples", "ux", "form"))

        self.__debugFlag = str(gLogger.getLevel() in ('DEBUG', 'VERBOSE',
                                                      'INFO')).lower()
        self.__inDir = os.path.join(os.path.dirname(self.__webAppPath), "Lib",
                                    "CompileTemplates")

        self.__senchacmddir = os.path.join(rootPath, "sbin", "Sencha", "Cmd")
        self.__senchaVersion = "v6.5.0.180"
Esempio n. 2
0
    def createCatalog(self, catalogName):
        """ Create a file catalog object from its name and CS description
    """
        # get the CS description first
        catalogPath = getCatalogPath(catalogName)
        catalogType = gConfig.getValue(catalogPath + "/CatalogType", catalogName)
        catalogURL = gConfig.getValue(catalogPath + "/CatalogURL", "")

        self.log.verbose("Creating %s client" % catalogName)
        moduleRootPaths = getInstalledExtensions()
        for moduleRootPath in moduleRootPaths:
            gLogger.verbose("Trying to load from root path %s" % moduleRootPath)
            # moduleFile = os.path.join( rootPath, moduleRootPath, "Resources", "Catalog", "%sClient.py" % catalogType )
            # gLogger.verbose( "Looking for file %s" % moduleFile )
            # if not os.path.isfile( moduleFile ):
            #  continue
            try:
                # This enforces the convention that the plug in must be named after the file catalog
                moduleName = "%sClient" % (catalogType)
                catalogModule = __import__(
                    "%s.Resources.Catalog.%s" % (moduleRootPath, moduleName), globals(), locals(), [moduleName]
                )
            except ImportError, x:
                if "No module" in str(x):
                    gLogger.debug("Catalog module %s not found in %s" % (catalogType, moduleRootPath))
                else:
                    errStr = "Failed attempt to import %s from the path %s: %s" % (catalogType, moduleRootPath, x)
                    gLogger.error(errStr)
                continue
            except Exception, x:
                errStr = "Failed attempt to import %s from the path %s: %s" % (catalogType, moduleRootPath, x)
                gLogger.error(errStr)
                continue
Esempio n. 3
0
    def createCatalog(self,
                      catalogName,
                      useProxy=False,
                      vo=None,
                      catalogConfig={}):
        """ Create a file catalog object from its name and CS description
    """
        if useProxy:
            catalog = FileCatalogProxyClient(catalogName)
            return S_OK(catalog)

        # get the CS description first
        catConfig = catalogConfig
        if not catConfig:
            if not vo:
                result = getVOfromProxyGroup()
                if not result['OK']:
                    return result
                vo = result['Value']
            reHelper = Resources(vo=vo)
            result = reHelper.getCatalogOptionsDict(catalogName)
            if not result['OK']:
                return result
            catConfig = result['Value']

        catalogType = catConfig.get('CatalogType', catalogName)
        catalogURL = catConfig.get('CatalogURL', '')

        self.log.verbose('Creating %s client' % catalogName)
        moduleRootPaths = getInstalledExtensions()
        for moduleRootPath in moduleRootPaths:
            gLogger.verbose("Trying to load from root path %s" %
                            moduleRootPath)
            #moduleFile = os.path.join( rootPath, moduleRootPath, "Resources", "Catalog", "%sClient.py" % catalogType )
            #gLogger.verbose( "Looking for file %s" % moduleFile )
            #if not os.path.isfile( moduleFile ):
            #  continue
            try:
                # This enforces the convention that the plug in must be named after the file catalog
                moduleName = "%sClient" % (catalogType)
                catalogModule = __import__(
                    '%s.Resources.Catalog.%s' % (moduleRootPath, moduleName),
                    globals(), locals(), [moduleName])
            except ImportError, x:
                if "No module" in str(x):
                    gLogger.debug('Catalog module %s not found in %s' %
                                  (catalogType, moduleRootPath))
                else:
                    errStr = "Failed attempt to import %s from the path %s: %s" % (
                        catalogType, moduleRootPath, x)
                    gLogger.error(errStr)
                continue
            except Exception, x:
                errStr = "Failed attempt to import %s from the path %s: %s" % (
                    catalogType, moduleRootPath, x)
                gLogger.error(errStr)
                continue
Esempio n. 4
0
 def __init__(self):
     self.__extVersion = SessionData.getExtJSVersion()
     self.staticPaths = []
     for ext in HandlerMgr().getPaths("static"):
         if "WebAppDIRAC" in ext:
             continue
         self.staticPaths.append(ext)
     #self.extensions = getInstalledExtensions()
     self.extensions = []
     for ext in getInstalledExtensions():
         if ext == "WebAppDIRAC":
             continue
         self.extensions.append(ext)
Esempio n. 5
0
  def __init__( self ):
    self.__extVersion = SessionData.getExtJSVersion()
    self.__staticPaths = HandlerMgr().getPaths( "static" )
    self.__extensions = getInstalledExtensions()
    self.__webAppPath = os.path.dirname( self.__staticPaths[-1] )
    self.__extPath = os.path.join( self.__webAppPath, "static", "extjs", self.__extVersion )
    self.__sdkPath = os.path.join( self.__webAppPath, "static", "extjs", self.__extVersion, "src" )

    self.__classPaths = [ os.path.join( self.__webAppPath, *p ) for p in ( ("static", "core", "js", "utils" ),
                                                                           ("static", "core", "js", "core" ))]
    self.__classPaths.append( os.path.join( self.__extPath, "examples", "ux", "form" ) )

    self.__debugFlag = str( gLogger.getLevel() in ( 'DEBUG', 'VERBOSE', 'INFO' ) ).lower()
    self.__inDir = os.path.join( os.path.dirname( self.__webAppPath ), "Lib", "CompileTemplates" )
Esempio n. 6
0
    def createCatalog(self, catalogName):
        """ Create a file catalog object from its name and CS description
    """
        # get the CS description first
        catalogPath = getCatalogPath(catalogName)
        catalogType = gConfig.getValue(catalogPath + '/CatalogType',
                                       catalogName)
        catalogURL = gConfig.getValue(catalogPath + '/CatalogURL', '')

        self.log.verbose('Creating %s client' % catalogName)
        moduleRootPaths = getInstalledExtensions()
        for moduleRootPath in moduleRootPaths:
            gLogger.verbose("Trying to load from root path %s" %
                            moduleRootPath)
            #moduleFile = os.path.join( rootPath, moduleRootPath, "Resources", "Catalog", "%sClient.py" % catalogType )
            #gLogger.verbose( "Looking for file %s" % moduleFile )
            #if not os.path.isfile( moduleFile ):
            #  continue
            try:
                # This enforces the convention that the plug in must be named after the file catalog
                moduleName = "%sClient" % (catalogType)
                catalogModule = __import__(
                    '%s.Resources.Catalog.%s' % (moduleRootPath, moduleName),
                    globals(), locals(), [moduleName])
            except ImportError, x:
                if "No module" in str(x):
                    gLogger.debug('Catalog module %s not found in %s' %
                                  (catalogType, moduleRootPath))
                else:
                    errStr = "Failed attempt to import %s from the path %s: %s" % (
                        catalogType, moduleRootPath, x)
                    gLogger.error(errStr)
                continue
            except Exception, x:
                errStr = "Failed attempt to import %s from the path %s: %s" % (
                    catalogType, moduleRootPath, x)
                gLogger.error(errStr)
                continue