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

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

Loading…
Cancel
Save