From: Barry Warsaw Date: Tue, 20 May 2003 17:26:48 +0000 (+0000) Subject: GNUTranslations._parse(): Fix SF bug #658233, where continuation lines X-Git-Tag: v2.3c1~657 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7de63f57c881cb94ba89c2a1dfaf79af1bba52bb;p=thirdparty%2FPython%2Fcpython.git GNUTranslations._parse(): Fix SF bug #658233, where continuation lines in .po metadata caused a crash. Backport candidate. --- diff --git a/Lib/gettext.py b/Lib/gettext.py index bc6779f3d885..6c8a7df76deb 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':