Merge branch 'master' of git.calculate.ru:/calculate-lib

develop
Самоукин Алексей 14 years ago
commit 24e5d97fdc

@ -5094,7 +5094,7 @@ class iniParser(_error, templateFormat):
"""Удаляем область из ini файла"""
if type(strHeader) in (tuple, list):
# Формат plasma
delStrHeader = strHeader[:]
delStrHeader = list(strHeader[:])
delStrHeader[-1] = "!%s"%delStrHeader[-1]
else:
# Формат samba

@ -500,7 +500,7 @@ def convertStrListDict(val):
if re.match("^{.*}$",val):
return str2dict(val)
# detect list
elif re.match("^[.*]$",val):
elif re.match("^\[.*\]$",val):
return str2list(val)
# else is simple string
else:
@ -617,6 +617,13 @@ def isMount(path):
map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "),
open(mtabFile)))),[""]))[0]
def commonPath(*paths):
"""Return common path from list of paths"""
paths = map(lambda x:os.path.abspath(x).split('/'),paths)
res = map(lambda x:x[0],
filter(lambda x:filter(lambda y:x[0]==y,x[1:]),zip(*paths)))
return "/".join(res)
def childMounts(path):
"""Get all mount points which contain path"""
if path != "none":
@ -627,7 +634,8 @@ def childMounts(path):
if not os.access(mtabFile,os.R_OK):
return ""
return reduce(lambda x,y: x + [y],
filter(lambda x: absPath in x[0] or absPath in x[1],
filter(lambda x: commonPath(absPath,x[0])==absPath or \
commonPath(absPath,x[1])==absPath,
map(lambda x: [x[0], x[1]],
map(lambda x: x.split(" "),
open(mtabFile)))),

@ -106,7 +106,7 @@ class patch(_error):
self.setError(\
_("Incorrect text template")+ ": \n" +\
"%s" %textNode)
return False
return False
else:
text = ""
dataList.append((regex, text))

Loading…
Cancel
Save