Browse Source

Fix openrc format. (Support = in variable value).

develop
Mike Hiretsky 11 years ago
parent
commit
b5376497bf
  1. 8
      pym/format/openrc.py

8
pym/format/openrc.py

@ -30,7 +30,7 @@ class openrc(procmail):
reComment = re.compile("[ \t]*%s" %(_comment))
reSepFields = re.compile(sepFields)
# разделитель названия и значения переменной
reSeparator = re.compile("=")
dataFieldSeparator = "="
def setDataField(self, txtLines, endtxtLines):
"""Создаем список объектов с переменными"""
@ -57,10 +57,10 @@ class openrc(procmail):
field = fieldData()
else:
pars = textLine.strip()
nameValue = self.reSeparator.split(pars)
if len(nameValue) == 2:
nameValue = pars.partition(self.dataFieldSeparator)
if nameValue[1] == self.dataFieldSeparator:
name = nameValue[0]
value = nameValue[1].replace(self.sepFields,"")
value = nameValue[2].replace(self.sepFields,"")
field.name = (name.replace(" ","").replace("\t","")).lower()
field.value = value
field.br = textLine

Loading…
Cancel
Save