From 42607776056ec43e5cb5839ceb78383d970f4519 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 28 Mar 2013 10:02:40 +0000 Subject: [PATCH] 5163: Another crash in same editor. svn: r21776 --- gramps/gen/display/name.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gramps/gen/display/name.py b/gramps/gen/display/name.py index 578bff562..a199926ac 100644 --- a/gramps/gen/display/name.py +++ b/gramps/gen/display/name.py @@ -1018,6 +1018,14 @@ class NameDisplay(object): # flag that works in standard python format strings. new_fmt = re.sub("|".join(patterns), "%s", new_fmt) + # replace special meaning codes we need to have verbatim in output + if (len(new_fmt) > 2 and new_fmt[0] == new_fmt[-1] == '"'): + new_fmt = new_fmt.replace('\\', r'\\') + new_fmt = new_fmt[1:-1].replace('"', r'\"') + else: + new_fmt = new_fmt.replace('\\', r'\\') + new_fmt = new_fmt.replace('"', '\\\"') + # find each format flag in the original format string # for each one we find the variable name that is needed to # replace it and add this to a list. This list will be used to