equal
deleted
inserted
replaced
45 parameter -- the name of a Postfix configuration parameter (str) |
45 parameter -- the name of a Postfix configuration parameter (str) |
46 expand_vars -- default True (bool) |
46 expand_vars -- default True (bool) |
47 """ |
47 """ |
48 if not re.match(RE_PC_PARAMS, parameter): |
48 if not re.match(RE_PC_PARAMS, parameter): |
49 raise VMMException(_(u'The value »%s« looks not like a valid\ |
49 raise VMMException(_(u'The value »%s« looks not like a valid\ |
50 postfix configuration parameter name.'), ERR.INVALID_AGUMENT) |
50 postfix configuration parameter name.') % parameter, ERR.INVALID_AGUMENT) |
51 self.__val = self.__read(parameter) |
51 self.__val = self.__read(parameter) |
52 if expand_vars: |
52 if expand_vars: |
53 self.__expandVars() |
53 self.__expandVars() |
54 return self.__val |
54 return self.__val |
55 |
55 |
60 if pvars_len < 1: |
60 if pvars_len < 1: |
61 break |
61 break |
62 if pvars_len > 1: |
62 if pvars_len > 1: |
63 self.__expandMultiVars(self.__readMulti(pvars)) |
63 self.__expandMultiVars(self.__readMulti(pvars)) |
64 continue |
64 continue |
65 for var in pvars: |
65 pvars = pvars.pop() |
66 self.__val = self.__val.replace(var, self.__read(var[1:])) |
66 self.__val = self.__val.replace(pvars, self.__read(pvars[1:])) |
67 |
67 |
68 def __expandMultiVars(self, old_new): |
68 def __expandMultiVars(self, old_new): |
69 for old, new in old_new.items(): |
69 for old, new in old_new.items(): |
70 self.__val = self.__val.replace('$'+old, new) |
70 self.__val = self.__val.replace('$'+old, new) |
71 |
71 |