|
|
@ -24,6 +24,7 @@ tr = cl_lang.lang()
|
|
|
|
tr.setLocalDomain('cl_lib')
|
|
|
|
tr.setLocalDomain('cl_lib')
|
|
|
|
tr.setLanguage(sys.modules[__name__])
|
|
|
|
tr.setLanguage(sys.modules[__name__])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cl_overriding
|
|
|
|
from cl_datavars import DataVars
|
|
|
|
from cl_datavars import DataVars
|
|
|
|
|
|
|
|
|
|
|
|
class APIError(Exception):
|
|
|
|
class APIError(Exception):
|
|
|
@ -57,7 +58,8 @@ class _services(color_print, libVars):
|
|
|
|
globals(), locals(),
|
|
|
|
globals(), locals(),
|
|
|
|
['serviceAPI']),
|
|
|
|
['serviceAPI']),
|
|
|
|
'serviceAPI')
|
|
|
|
'serviceAPI')
|
|
|
|
except (ImportError, AttributeError):
|
|
|
|
except (ImportError, AttributeError), e:
|
|
|
|
|
|
|
|
self.printERROR(str(e).strip())
|
|
|
|
self.printERROR(_("Can not import module %s")% apiFile)
|
|
|
|
self.printERROR(_("Can not import module %s")% apiFile)
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
return className
|
|
|
|
return className
|
|
|
@ -75,7 +77,8 @@ class _services(color_print, libVars):
|
|
|
|
className = self.getApiClass(apiFile)
|
|
|
|
className = self.getApiClass(apiFile)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
apiObject = className()
|
|
|
|
apiObject = className()
|
|
|
|
except:
|
|
|
|
except Exception, e:
|
|
|
|
|
|
|
|
self.printERROR(str(e).strip())
|
|
|
|
self.printERROR(_("Can not create API object"))
|
|
|
|
self.printERROR(_("Can not create API object"))
|
|
|
|
self.printERROR(_("Module %s")% apiFile)
|
|
|
|
self.printERROR(_("Module %s")% apiFile)
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
cl_overriding.exit(1)
|
|
|
@ -152,13 +155,13 @@ class _pkgAPI(object):
|
|
|
|
def __init__(self, pkgName):
|
|
|
|
def __init__(self, pkgName):
|
|
|
|
services = _services()
|
|
|
|
services = _services()
|
|
|
|
self.var = False
|
|
|
|
self.var = False
|
|
|
|
varObj = services.runMethodToPkg(pkgName, 'getVars')
|
|
|
|
varObj = services.runMethodToPkg(pkgName, 'get_vars')
|
|
|
|
if varObj:
|
|
|
|
if varObj:
|
|
|
|
self.var = attribute(varObj)
|
|
|
|
self.var = attribute(varObj)
|
|
|
|
pkgObj = services.getPkgApi(pkgName)
|
|
|
|
pkgObj = services.getPkgApi(pkgName)
|
|
|
|
for attr in dir(pkgObj):
|
|
|
|
for attr in dir(pkgObj):
|
|
|
|
if not attr.startswith("_") and callable(getattr(pkgObj, attr)) and\
|
|
|
|
if not attr.startswith("_") and callable(getattr(pkgObj, attr)) and\
|
|
|
|
getattr(pkgObj, attr).im_func.func_code.co_varnames==('self',):
|
|
|
|
getattr(pkgObj, attr).im_func.func_code.co_argcount == 1:
|
|
|
|
setattr(self, attr, getattr(pkgObj, attr))
|
|
|
|
setattr(self, attr, getattr(pkgObj, attr))
|
|
|
|
|
|
|
|
|
|
|
|
def __getattribute__(self, attr):
|
|
|
|
def __getattribute__(self, attr):
|
|
|
@ -180,8 +183,8 @@ class _allPkg(object):
|
|
|
|
|
|
|
|
|
|
|
|
to sort in descending order
|
|
|
|
to sort in descending order
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
prioritetA = objectA.getPrioritet()
|
|
|
|
prioritetA = objectA.get_prioritet()
|
|
|
|
prioritetB = objectB.getPrioritet()
|
|
|
|
prioritetB = objectB.get_prioritet()
|
|
|
|
if prioritetA == prioritetB:
|
|
|
|
if prioritetA == prioritetB:
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
elif prioritetA < prioritetB:
|
|
|
|
elif prioritetA < prioritetB:
|
|
|
@ -194,8 +197,8 @@ class _allPkg(object):
|
|
|
|
|
|
|
|
|
|
|
|
to sort in descending order
|
|
|
|
to sort in descending order
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
prioritetA = objectA.getPrioritet()
|
|
|
|
prioritetA = objectA.get_prioritet()
|
|
|
|
prioritetB = objectB.getPrioritet()
|
|
|
|
prioritetB = objectB.get_prioritet()
|
|
|
|
if prioritetA == prioritetB:
|
|
|
|
if prioritetA == prioritetB:
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
elif prioritetA > prioritetB:
|
|
|
|
elif prioritetA > prioritetB:
|
|
|
|