]> granicus.if.org Git - python/commitdiff
GNUTranslations._parse(): Fix SF bug #658233, where continuation lines
authorBarry Warsaw <barry@python.org>
Tue, 20 May 2003 17:26:48 +0000 (17:26 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 20 May 2003 17:26:48 +0000 (17:26 +0000)
in .po metadata caused a crash.

Backport candidate.

Lib/gettext.py

index bc6779f3d88520d04389a91c5a3275fd10fd6772..6c8a7df76debae2cab2c1c6f11a8fc02e4993f59 100644 (file)
@@ -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':