Добавлено вычисление функций, в заголовке профиля.

git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@728 c91db197-33c1-4113-bf15-f8a5c547ca64
develop
asamoukin 16 years ago
parent ac908c2e40
commit debed73e5b

@ -240,7 +240,8 @@ class calcHeader(_terms):
# Сообщение о ошибке
errorMessage = ""
def __init__(self, text, comment=False, fileType=False, objVar=False):
def __init__(self, text, comment=False, fileType=False, objVar=False,
function=False):
self.body = text
# Объект с переменными
self.objVar=objVar
@ -292,23 +293,31 @@ class calcHeader(_terms):
paramList = re.split("\s+",paramLine)
if paramList:
for i in paramList:
foundTerm = False
for term in self.terms:
if term in i:
if not self._equalTerm(i,\
_("header profile not valid: ") + \
i):
foundTerm = True
if function:
rezTerm = self._equalTerm(i,\
_("header profile not valid: ") + \
i,function)
else:
rezTerm = self._equalTerm(i,\
_("header profile not valid: ") + \
i)
if not rezTerm:
self.headerTerm = False
break
else:
par = i.split("=")
if len(par) == 1:
if i in self.listParNotVal:
self.params[i] = "True"
else:
if i.strip():
incorrectParams = set([i])
elif len(par) == 2:
self.params[par[0]] = par[1]
if not foundTerm:
par = i.split("=")
if len(par) == 1:
if i in self.listParNotVal:
self.params[i] = "True"
else:
if i.strip():
incorrectParams = set([i])
elif len(par) == 2:
self.params[par[0]] = par[1]
self.comment = self._getComment()
self.fileType = self._getType()
@ -2057,6 +2066,11 @@ class profile(_file, _terms):
обязательный параметр
"""
# Имена установленных программ
installProg = []
# Версии установленных программ
installProgVersions = []
def __init__(self, objVar, servDir=False):
_file.__init__(self)
# Словарь для создания объектов новых классов по образцу
@ -2091,10 +2105,6 @@ class profile(_file, _terms):
self._baseDir = ""
# Последняя часть директории профиля (имя сервиса: samba, mail)
self._servDir = servDir
# Имена установленных программ
self.installProg = []
# Версии установленных программ
self.installProgVersions = []
if self._servDir:
if self._servDir[0] != "/":
@ -2475,6 +2485,11 @@ class profile(_file, _terms):
def __getApplyHeadProfile(self ,newFile, oldFile, copyFile):
"""Применяет заголовок к профилю (права, владелец, и.т. д)"""
def function(text):
"""Функция обработки функций в заголовке"""
return self.applyFuncProfile(text, newFile, oldFile)
self.closeFiles()
# Файлы в системе к которым были применены профили
applyFiles = [oldFile]
@ -2484,7 +2499,8 @@ class profile(_file, _terms):
self.newProfile = self.FN.read()
self.closeNewFile()
objHeadNew = calcHeader(self.newProfile, False,
self.getFileType(),objVar=self.objVar)
self.getFileType(),objVar=self.objVar,
function=function)
if not objHeadNew.headerCorrect:
self.setError(_("Incorrect profile: " ) +\
newFile)

Loading…
Cancel
Save