Potential patch for an Issue #914

This commit is contained in:
Miroslav Stampar 2014-11-10 14:51:31 +01:00
parent cdbfb17408
commit dfa8e0456d

View File

@ -1544,13 +1544,14 @@ def safeStringFormat(format_, params):
elif not isListLike(params): elif not isListLike(params):
retVal = retVal.replace("%s", str(params), 1) retVal = retVal.replace("%s", str(params), 1)
else: else:
count, index = 0, 0 start, end = 0, len(retVal)
if retVal.count("%s") == len(params): match = re.search(r"%s(.+)%s" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), retVal)
while index != -1: if match and PAYLOAD_DELIMITER not in match.group(1):
index = retVal.find("%s") start, end = match.start(), match.end()
if index != -1: if retVal.count("%s", start, end) == len(params):
retVal = retVal[:index] + getUnicode(params[count]) + retVal[index + 2:] for param in params:
count += 1 index = retVal.find("%s", start)
retVal = retVal[:index] + getUnicode(param) + retVal[index + 2:]
else: else:
count = 0 count = 0
while True: while True: