diff options
author | Barry Warsaw <barry@python.org> | 2003-05-20 17:26:48 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2003-05-20 17:26:48 (GMT) |
commit | 7de63f57c881cb94ba89c2a1dfaf79af1bba52bb (patch) | |
tree | 5c6538c3641a420823d9ada4b1c272f64c552ea7 /Lib/gettext.py | |
parent | 15eac1f95c53b0e162c460cfdbf4e490184f375e (diff) | |
download | cpython-7de63f57c881cb94ba89c2a1dfaf79af1bba52bb.zip cpython-7de63f57c881cb94ba89c2a1dfaf79af1bba52bb.tar.gz cpython-7de63f57c881cb94ba89c2a1dfaf79af1bba52bb.tar.bz2 |
GNUTranslations._parse(): Fix SF bug #658233, where continuation lines
in .po metadata caused a crash.
Backport candidate.
Diffstat (limited to 'Lib/gettext.py')
-rw-r--r-- | Lib/gettext.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/gettext.py b/Lib/gettext.py index bc6779f..6c8a7df 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -261,14 +261,19 @@ class GNUTranslations(NullTranslations): # See if we're looking at GNU .mo conventions for metadata if mlen == 0: # Catalog description + lastk = None for item in tmsg.splitlines(): item = item.strip() if not item: continue - k, v = item.split(':', 1) - k = k.strip().lower() - v = v.strip() - self._info[k] = v + if ':' in item: + k, v = item.split(':', 1) + k = k.strip().lower() + v = v.strip() + self._info[k] = v + lastk = k + elif lastk: + self._info[lastk] += '\n' + item if k == 'content-type': self._charset = v.split('charset=')[1] elif k == 'plural-forms': |