[Python-checkins] python/dist/src/Lib gettext.py,1.11.24.1,1.11.24.2

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Tue, 20 May 2003 15:33:06 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv19453

Modified Files:
      Tag: release22-maint
	gettext.py 
Log Message:
GNUTranslations._parse(): Backport of fix for SF bug #658233, where
continuation lines in .po metadata caused a crash.

Also, export more symbols from __all__.


Index: gettext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v
retrieving revision 1.11.24.1
retrieving revision 1.11.24.2
diff -C2 -d -r1.11.24.1 -r1.11.24.2
*** gettext.py	11 Jan 2002 06:37:07 -0000	1.11.24.1
--- gettext.py	20 May 2003 22:33:03 -0000	1.11.24.2
***************
*** 49,54 ****
  from errno import ENOENT
  
! __all__ = ["bindtextdomain","textdomain","gettext","dgettext",
!            "find","translation","install","Catalog"]
  
  _default_localedir = os.path.join(sys.prefix, 'share', 'locale')
--- 49,56 ----
  from errno import ENOENT
  
! __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',
!            'find', 'translation', 'install', 'textdomain', 'bindtextdomain',
!            'dgettext', 'gettext',
!            ]
  
  _default_localedir = os.path.join(sys.prefix, 'share', 'locale')
***************
*** 174,185 ****
              if mlen == 0 and tmsg.lower().startswith('project-id-version:'):
                  # Catalog description
                  for item in tmsg.split('\n'):
                      item = item.strip()
                      if not item:
                          continue
!                     k, v = item.split(':', 1)
!                     k = k.strip().lower()
!                     v = v.strip()
!                     self._info[k] = v
                      if k == 'content-type':
                          self._charset = v.split('charset=')[1]
--- 176,192 ----
              if mlen == 0 and tmsg.lower().startswith('project-id-version:'):
                  # Catalog description
+                 lastk = None
                  for item in tmsg.split('\n'):
                      item = item.strip()
                      if not item:
                          continue
!                     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]