Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/converters.py

Issue 5172705124941824: Issue 2452 - Avoid replacing "\n" with newline in fixed strings (Closed)
Patch Set: Tidied up loop Created May 6, 2015, 4:29 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
diff --git a/cms/converters.py b/cms/converters.py
index 34ded27a78058824d5e34abef7c6f2975350411d..fa7ef2cd773795eeacb0b850b38a0ca00bb68c4b 100644
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -142,8 +142,8 @@ class Converter:
result = default
# Insert fixed strings
- for i in range(len(fixed_strings)):
- result = re.sub(r"\{%d\}" % (i + 1), fixed_strings[i], result, 1)
+ for i, fixed_string in enumerate(fixed_strings, 1):
+ result = result.replace("{%d}" % i, fixed_string)
# Insert attributes
result = escape(result)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld