Bugfix (error if only comment in /etc/calculate/calculate2.env)

develop
Самоукин Алексей 14 years ago
parent 1db6e4368b
commit b2fbc7631d

@ -4847,11 +4847,20 @@ class iniParser(_error, templateFormat):
return True return True
def isEmptyFile(self, textIni): def isEmptyFile(self, textIni):
"""Является ли файл пустым""" """Если файл пустой или содержит только комментарии - False
if not textIni.strip():
return True иначе - True
"""
if textIni.strip():
if filter(lambda x: x.strip(),
map(lambda x:x[0].split(";")[0],
map(lambda x: x.split("#"),
textIni.splitlines()))):
return False
else:
return True
else: else:
return False return True
def checkIniFile(self, textIni): def checkIniFile(self, textIni):
"""Проверка на правильность формата файла""" """Проверка на правильность формата файла"""

@ -203,6 +203,8 @@ class plasma(samba):
blTmp = self.blocTextObj.findBloc(self.text,self.reHeader,self.reBody) blTmp = self.blocTextObj.findBloc(self.text,self.reHeader,self.reBody)
blocs = self.getFullAreas(blTmp) blocs = self.getFullAreas(blTmp)
if blocs == []:
return []
reH = re.compile("\[([^\[\]]+)\]") reH = re.compile("\[([^\[\]]+)\]")
# Список имен блоков # Список имен блоков
namesBlockList = [] namesBlockList = []

Loading…
Cancel
Save