Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 377036 Details for
Bug 482034
www-apps/trac-1.0.1 - migrate to distutils-r1.eclass
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
1.0.1-changeset_12275.diff
1.0.1-changeset_12275.diff (text/plain), 5.35 KB, created by
Bertrand Jacquin
on 2014-05-15 22:16:17 UTC
(
hide
)
Description:
1.0.1-changeset_12275.diff
Filename:
MIME Type:
Creator:
Bertrand Jacquin
Created:
2014-05-15 22:16:17 UTC
Size:
5.35 KB
patch
obsolete
>Index: /branches/1.0-stable/trac/util/tests/__init__.py >=================================================================== >--- /branches/1.0-stable/trac/util/tests/__init__.py (revision 12274) >+++ /branches/1.0-stable/trac/util/tests/__init__.py (revision 12275) >@@ -22,5 +22,6 @@ > > from trac import util >-from trac.util.tests import concurrency, datefmt, presentation, text, html >+from trac.util.tests import concurrency, datefmt, presentation, text, \ >+ translation, html > > >@@ -182,4 +183,5 @@ > suite.addTest(doctest.DocTestSuite(util)) > suite.addTest(text.suite()) >+ suite.addTest(translation.suite()) > suite.addTest(html.suite()) > return suite >Index: /branches/1.0-stable/trac/util/tests/translation.py >=================================================================== >--- /branches/1.0-stable/trac/util/tests/translation.py (revision 12275) >+++ /branches/1.0-stable/trac/util/tests/translation.py (revision 12275) >@@ -0,0 +1,83 @@ >+# -*- coding: utf-8 -*- >+# >+# Copyright (C) 2013 Edgewall Software >+# All rights reserved. >+# >+# This software is licensed as described in the file COPYING, which >+# you should have received as part of this distribution. The terms >+# are also available at http://trac.edgewall.org/wiki/TracLicense. >+# >+# This software consists of voluntary contributions made by many >+# individuals. For the exact contribution history, see the revision >+# history and logs, available at http://trac.edgewall.org/log/. >+ >+import shutil >+import tempfile >+import unittest >+from pkg_resources import resource_exists, resource_filename >+try: >+ import babel >+except ImportError: >+ babel = None >+ locale_identifiers = lambda: () >+else: >+ try: >+ from babel.localedata import locale_identifiers >+ except ImportError: >+ from babel.localedata import list as locale_identifiers >+ >+from trac.test import EnvironmentStub >+from trac.util import translation >+ >+ >+class TranslationsProxyTestCase(unittest.TestCase): >+ >+ def setUp(self): >+ self.env = EnvironmentStub() >+ self.env.path = tempfile.mkdtemp(prefix='trac-tempenv-') >+ >+ def tearDown(self): >+ translation.deactivate() >+ self.env.reset_db() >+ shutil.rmtree(self.env.path) >+ >+ def _get_locale_dir(self): >+ return resource_filename('trac', 'locale') >+ >+ def _get_available_locales(self): >+ return sorted(locale >+ for locale in translation.get_available_locales() >+ if resource_exists('trac', >+ 'locale/%s/LC_MESSAGES/messages.mo' >+ % locale)) >+ >+ def test_activate(self): >+ locales = self._get_available_locales() >+ if locales: >+ translation.activate(locales[0], self.env.path) >+ >+ def test_activate_unavailable_locale(self): >+ unavailables = sorted(set(locale_identifiers()) - >+ set(translation.get_available_locales())) or \ >+ ('en_US',) >+ locale_dir = self._get_locale_dir() >+ translation.add_domain('catalog1', self.env.path, locale_dir) >+ translation.add_domain('catalog2', self.env.path, locale_dir) >+ translation.activate(unavailables[0], self.env.path) >+ >+ def test_activate_with_non_existent_catalogs(self): >+ locales = self._get_available_locales() >+ if locales: >+ locale_dir = self._get_locale_dir() >+ translation.add_domain('catalog1', self.env.path, locale_dir) >+ translation.add_domain('catalog2', self.env.path, locale_dir) >+ translation.activate(locales[0], self.env.path) >+ >+ >+def suite(): >+ suite = unittest.TestSuite() >+ suite.addTest(unittest.makeSuite(TranslationsProxyTestCase, 'test')) >+ return suite >+ >+if __name__ == '__main__': >+ unittest.main(defaultTest='suite') >Index: /branches/1.0-stable/trac/util/translation.py >=================================================================== >--- /branches/1.0-stable/trac/util/translation.py (revision 12274) >+++ /branches/1.0-stable/trac/util/translation.py (revision 12275) >@@ -150,6 +150,6 @@ > t = self._null_translations > else: >- t.add(Translations.load(locale_dir, locale or 'en_US', >- 'tracini')) >+ self._add(t, Translations.load(locale_dir, locale or 'en_US', >+ 'tracini')) > if env_path: > with self._plugin_domains_lock: >@@ -157,5 +157,6 @@ > domains = domains.items() > for domain, dirname in domains: >- t.add(Translations.load(dirname, locale, domain)) >+ self._add(t, Translations.load(dirname, locale, >+ domain)) > self._current.translations = t > self._activate_failed = False >@@ -184,4 +185,10 @@ > return self._current.translations is not None \ > or self._activate_failed >+ >+ # Internal methods >+ >+ def _add(self, t, translations): >+ if isinstance(translations, Translations): >+ t.add(translations) > > # Delegated methods
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 482034
:
356648
|
356650
|
356652
|
357850
|
357858
|
357860
|
357862
|
357864
|
357866
|
357868
|
357870
|
357872
|
357874
|
357876
|
357878
|
357880
|
357882
|
357884
|
357886
|
357888
|
376934
|
377034
| 377036 |
377038