fixed xml in xfce format

py3_forced
parent 5ebeb22900
commit c23f429c8a

@ -641,17 +641,17 @@ class DataVars():
pass
# добавляем пути к модулям если они не добавлены
if not os.path.abspath(\
'/usr/lib/calculate/calculate-server/pym') in sys.path:
'/usr/lib/calculate/calculate-server/pym') in sys.path:
sys.path.insert(0,os.path.abspath(\
'/usr/lib/calculate/calculate-server/pym'))
'/usr/lib/calculate/calculate-server/pym'))
if not os.path.abspath(\
'/usr/lib/calculate/calculate-lib/pym') in sys.path:
'/usr/lib/calculate/calculate-lib/pym') in sys.path:
sys.path.insert(0,os.path.abspath(\
'/usr/lib/calculate/calculate-lib/pym'))
'/usr/lib/calculate/calculate-lib/pym'))
if not os.path.abspath(\
'/usr/lib/calculate/calculate-builder/pym') in sys.path:
'/usr/lib/calculate/calculate-builder/pym') in sys.path:
sys.path.insert(0,os.path.abspath(\
'/usr/lib/calculate/calculate-builder/pym'))
'/usr/lib/calculate/calculate-builder/pym'))
# Импортируемые модули - (раздел: модуль переменных, модуль заполнения
#переменных)
__modlist={
@ -699,7 +699,7 @@ class DataVars():
flagFindFillModule = False
else:
err1 = _("Error in import module %s")%modFill
err2 = _("error") + ": " +str(e)
err2 = _("error") + ": " + str(e)
raise self.DataVarsError("%s\n%s"%(err1,err2))
if flagFindFillModule:
# Создаем объект с методами заполнения переменных
@ -731,11 +731,11 @@ class DataVars():
if dataVar:
break
if dataVar == False:
err1 = _("Not found variable %s")%nameVar
err1 = _("Not found variable %s") % nameVar
err2 = ""
if err:
err2 = _("error") + ": " +str(err)
raise self.DataVarsError("%s\n%s"%(err1, err2))
raise self.DataVarsError("%s\n%s" % (err1, err2))
dataVar['service'] = section
# Ищем метод в объекте методов заполнения
nameMethod = "get_" + nameVar
@ -794,13 +794,12 @@ class DataVars():
return ret
def Get(self, nameVar):
tmp = self.__Get(nameVar)
#TODO remove this
#DEBUG
isBytes = isinstance(tmp, bytes)
if isBytes:
print(f"DEBUG: var {nameVar} returned bytes value: {tmp}")
return tmp.decode("UTF-8") if isBytes else tmp
# tmp = self.__Get(nameVar)
# isBytes = isinstance(tmp, bytes)
# if isBytes:
# print(f"DEBUG: var {nameVar} returned bytes value: {tmp}")
# return tmp.decode("UTF-8") if isBytes else tmp
return self.__Get(nameVar)
def __Set(self, nameVar, value, force=False):

@ -362,14 +362,14 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon, prnServ):
'Administrators':self.addInfoGroup('Administrators',
'544',
'Domain Members can fully \
administer the computer/sambaDomainName',
administer the computer/sambaDomainName',
'544',
'5',
"S-1-5-32-544"),
'Account Operators':self.addInfoGroup('Account Operators',
'548',
'Domain Users to manipulate \
users accounts',
users accounts',
'548',
'5',
"S-1-5-32-548"),
@ -388,14 +388,14 @@ users accounts',
'Backup Operators':self.addInfoGroup('Backup Operators',
'551',
'Domain Members can bypass \
file security to back up files',
file security to back up files',
'551',
'5',
"S-1-5-32-551"),
'Replicators':self.addInfoGroup('Replicators',
'552',
'Domain Supports file replication \
in a sambaDomainName',
in a sambaDomainName',
'552',
'5',
"S-1-5-32-552"),
@ -1128,7 +1128,7 @@ in a sambaDomainName',
searchUser = self.searchLdapDN(userName, self.relUsersDN, attr)
if not searchUser:
self.printERROR(_("User") + " " + str(userName) + " "+\
_("not found"))
_("not found"))
return False
modAttrs = []
if not self.dataIsJpeg(photoData):
@ -1147,14 +1147,14 @@ in a sambaDomainName',
retcode = pipe.wait()
if retcode != 0:
self.printERROR(_("Can not convert file '%s' in jpeg format")\
%photoPath)
% photoPath)
flagError = True
fErr.close()
if not flagError:
photoData = fOut.read()
if not self.dataIsJpeg(photoData):
self.printERROR(\
_("Can not convert file '%s' in jpeg format") %photoPath)
_("Can not convert file '%s' in jpeg format") % photoPath)
flagError = True
fOut.close()
if flagError:
@ -14953,7 +14953,7 @@ with another option."))
# Изменяем значения аттрибутов для вывода на печать
#modUserAttr already decodes
ldapValue[0] = self.modUserAttr(attr, ldapValue[0],
service)
service)
flagFirst = False
for value in ldapValue:
if not flagFirst:

@ -33,27 +33,27 @@ class log():
fd = os.open(self.logFile, os.O_CREAT,0o600)
os.close(fd)
except:
print("Error creating file %s"%self.logFile)
print("Error creating file %s" % self.logFile)
return False
textWrite = textLog
if not textLog[-1:] == "\n" :
textWrite = "%s\n"%textLog
textWrite = "%s\n" % textLog
if self.addDataTime:
textWrite = "%s %s"%(time.strftime("%d/%m/%Y %H:%M:%S",\
time.localtime()),textWrite)
textWrite = "%s %s" % (time.strftime("%d/%m/%Y %H:%M:%S",\
time.localtime()), textWrite)
try:
FD = open (self.logFile, "a")
FD.write(textWrite)
FD.close()
except:
print("Error writing to file %s"%self.logFile)
print("Error writing to file %s" % self.logFile)
return False
return True
def writeError(self, textLog):
"""Добавляет сообщение об ошибке в log"""
return self.addLog("ERROR: %s" %textLog)
return self.addLog("ERROR: %s" % textLog)
def writeSuccess(self, textLog):
"""Добавляет сообщение об успехе в log"""
return self.addLog("SUCCESS: %s" %textLog)
return self.addLog("SUCCESS: %s" % textLog)

@ -5670,9 +5670,9 @@ class xml_xfce(_error):
# Объединение нод
if flagJoin:
if "value" in nextOldNode.keys():
oValue = nextOldNode.getAttribute("value")
oValue = nextOldNode.get("value")
if nValue != oValue:
nextOldNode.setAttribute("value", nValue)
nextOldNode.set("value", nValue)
# Замещение ноды
elif flagReplace:
replaceXmlNode = deepcopy(xmlNode)

@ -606,4 +606,4 @@ def getIpNet(ip,mask=None,cidr=None):
mask = cidrToMask(net)
mask = strIpToIntIp(mask)
return "{ip}/{net}".format(ip=intIpToStrIp(ip&mask),
net=net)
net=net)

Loading…
Cancel
Save