Chris McDonough
2011-06-22 6ed33ec54b0dae6ae2a38a0c7a6d383e2ac1967e
- If multiple specs were provided in a single call to
``config.add_translation_dirs``, the directories were inserted into the
beginning of the directory list in the wrong order: they were inserted in
the reverse of the order they were provided in the ``*specs`` list (items
later in the list trumped ones earlier in the list). This is now fixed.

Note however, that later calls to ``config.add_translation_dirs`` continue
to insert directories into the beginning of the list of translation
directories created by earlier calls. This means that the same translation
found in a directory added via ``add_translation_dirs`` later in the
configuration process will be found before one added earlier via a separate
call to ``add_translation_dirs`` in the configuration process.
12 files added
3 files modified
178 ■■■■■ changed files
CHANGES.txt 13 ●●●●● patch | view | raw | blame | history
pyramid/config.py 11 ●●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale2/GARBAGE 1 ●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale2/be/LC_MESSAGES 1 ●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.mo patch | view | raw | blame | history
pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.po 31 ●●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.mo patch | view | raw | blame | history
pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.po 31 ●●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale3/GARBAGE 1 ●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale3/be/LC_MESSAGES 1 ●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.mo patch | view | raw | blame | history
pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.po 31 ●●●●● patch | view | raw | blame | history
pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.mo patch | view | raw | blame | history
pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.po 31 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_config.py 26 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -8,6 +8,19 @@
  for ``pyramid.paster.PyramidTemplate``.  Now one has been added, although a
  deprecation warning is raised.
- If multiple specs were provided in a single call to
  ``config.add_translation_dirs``, the directories were inserted into the
  beginning of the directory list in the wrong order: they were inserted in
  the reverse of the order they were provided in the ``*specs`` list (items
  later in the list trumped ones earlier in the list).  This is now fixed.
  Note however, that later calls to ``config.add_translation_dirs`` continue
  to insert directories into the beginning of the list of translation
  directories created by earlier calls.  This means that the same translation
  found in a directory added via ``add_translation_dirs`` later in the
  configuration process will be found before one added earlier via a separate
  call to ``add_translation_dirs`` in the configuration process.
Backwards Incompatibilities
---------------------------
pyramid/config.py
@@ -2245,8 +2245,17 @@
           config.add_translation_dirs('/usr/share/locale',
                                       'some.package:locale')
        Later calls to ``add_translation_dir`` insert directories into the
        beginning of the list of translation directories created by earlier
        calls.  This means that the same translation found in a directory
        added later in the configuration process will be found before one
        added earlier in the configuration process.  However, if multiple
        specs are provided in a single call to ``add_translation_dirs``, the
        directories will be inserted into the beginning of the directory list
        in the order they're provided in the ``*specs`` list argument (items
        earlier in the list trump ones later in the list).
        """
        for spec in specs:
        for spec in specs[::-1]: # reversed
            package_name, filename = self._split_spec(spec)
            if package_name is None: # absolute filename
pyramid/tests/localeapp/locale2/GARBAGE
New file
@@ -0,0 +1 @@
Garbage file.
pyramid/tests/localeapp/locale2/be/LC_MESSAGES
New file
@@ -0,0 +1 @@
busted.
pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.mo
Binary files differ
pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.po
New file
@@ -0,0 +1,31 @@
# German translations for deformsite.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the deformsite project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: deformsite 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-04-22 14:17+0400\n"
"PO-Revision-Date: 2010-04-22 14:17-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.5\n"
#: deformsite/__init__.py:458
msgid "Approve"
msgstr "Genehmigen"
#: deformsite/__init__.py:459
msgid "Show approval"
msgstr "Zeigen Genehmigung"
#: deformsite/__init__.py:466
msgid "Submit"
msgstr "Beugen"
pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.mo
Binary files differ
pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.po
New file
@@ -0,0 +1,31 @@
# German translations for deformsite.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the deformsite project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: deformsite 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-04-22 14:17+0400\n"
"PO-Revision-Date: 2010-04-22 14:17-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.5\n"
#: deformsite/__init__.py:458
msgid "Approve"
msgstr "Genehmigen"
#: deformsite/__init__.py:459
msgid "Show approval"
msgstr "Zeigen Genehmigung"
#: deformsite/__init__.py:466
msgid "Submit"
msgstr "Beugen"
pyramid/tests/localeapp/locale3/GARBAGE
New file
@@ -0,0 +1 @@
Garbage file.
pyramid/tests/localeapp/locale3/be/LC_MESSAGES
New file
@@ -0,0 +1 @@
busted.
pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.mo
Binary files differ
pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.po
New file
@@ -0,0 +1,31 @@
# German translations for deformsite.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the deformsite project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: deformsite 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-04-22 14:17+0400\n"
"PO-Revision-Date: 2010-04-22 14:17-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.5\n"
#: deformsite/__init__.py:458
msgid "Approve"
msgstr "Genehmigen"
#: deformsite/__init__.py:459
msgid "Show approval"
msgstr "Zeigen Genehmigung"
#: deformsite/__init__.py:466
msgid "Submit"
msgstr "Beugen"
pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.mo
Binary files differ
pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.po
New file
@@ -0,0 +1,31 @@
# German translations for deformsite.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the deformsite project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: deformsite 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-04-22 14:17+0400\n"
"PO-Revision-Date: 2010-04-22 14:17-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.5\n"
#: deformsite/__init__.py:458
msgid "Approve"
msgstr "Genehmigen"
#: deformsite/__init__.py:459
msgid "Show approval"
msgstr "Zeigen Genehmigung"
#: deformsite/__init__.py:466
msgid "Submit"
msgstr "Beugen"
pyramid/tests/test_config.py
@@ -2499,6 +2499,32 @@
        result = config.registry.getUtility(ITranslationDirectories)
        self.assertEqual(result, [locale, 'abc'])
    def test_add_translation_dirs_multiple_specs(self):
        import os
        from pyramid.interfaces import ITranslationDirectories
        config = self._makeOne(autocommit=True)
        config.add_translation_dirs('pyramid.tests.localeapp:locale',
                                    'pyramid.tests.localeapp:locale2')
        here = os.path.dirname(__file__)
        locale = os.path.join(here, 'localeapp', 'locale')
        locale2 = os.path.join(here, 'localeapp', 'locale2')
        self.assertEqual(config.registry.getUtility(ITranslationDirectories),
                         [locale, locale2])
    def test_add_translation_dirs_multiple_specs_multiple_calls(self):
        import os
        from pyramid.interfaces import ITranslationDirectories
        config = self._makeOne(autocommit=True)
        config.add_translation_dirs('pyramid.tests.localeapp:locale',
                                    'pyramid.tests.localeapp:locale2')
        config.add_translation_dirs('pyramid.tests.localeapp:locale3')
        here = os.path.dirname(__file__)
        locale = os.path.join(here, 'localeapp', 'locale')
        locale2 = os.path.join(here, 'localeapp', 'locale2')
        locale3 = os.path.join(here, 'localeapp', 'locale3')
        self.assertEqual(config.registry.getUtility(ITranslationDirectories),
                         [locale3, locale, locale2])
    def test_add_translation_dirs_registers_chameleon_translate(self):
        from pyramid.interfaces import IChameleonTranslate
        from pyramid.threadlocal import manager