[Zope3-checkins] CVS: Zope3/src/zope/i18n - rm_dtd.py:1.1 locales.py:1.5

Stephan Richter srichter@cbu.edu
Thu, 9 Jan 2003 14:20:41 -0500


Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv850/i18n

Modified Files:
	locales.py 
Added Files:
	rm_dtd.py 
Log Message:
Removed requirement for os.chdir()

Removed DOCTYPE definition from XML Locale Files. Provide a script to do
that automatically for all files.

Deactivate parsing all XML Files tests, since they took a long time.


=== Added File Zope3/src/zope/i18n/rm_dtd.py ===
##############################################################################
#
# Copyright (c) 2002, 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Removes the DOCTYPE line from the Locale XML Files.

$Id: rm_dtd.py,v 1.1 2003/01/09 19:19:39 srichter Exp $
"""
import os, re
from zope import i18n

locale_dir = os.path.join(os.path.dirname(i18n.__file__), 'locales')

for file in filter(lambda f: f.endswith('.xml'),
                   os.listdir(locale_dir)):
    path = os.path.join(locale_dir, file)
    print path
    data = open(path, 'r').read()
    data = data.replace(
        '<!DOCTYPE localeData SYSTEM "./LocaleElements.dtd" >\n', '')
    open(path, 'w').write(data)


=== Zope3/src/zope/i18n/locales.py 1.4 => 1.5 ===
--- Zope3/src/zope/i18n/locales.py:1.4	Thu Jan  9 09:33:29 2003
+++ Zope3/src/zope/i18n/locales.py	Thu Jan  9 14:19:38 2003
@@ -96,10 +96,7 @@
                   'The desired locale is not available.\nPath: %s' %path
             
         # Let's get it!
-        org = os.curdir
-        os.chdir(LOCALEDIR)
         locale = ICUXMLLocaleFactory(path)()
-        os.chdir(org)
         self._locales[(language, country, variant)] = locale