Hello community,

here is the log from the commit of package python-translationstring for 
openSUSE:Factory checked in at 2015-02-06 22:38:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-translationstring (Old)
 and      /work/SRC/openSUSE:Factory/.python-translationstring.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-translationstring"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-translationstring/python-translationstring.changes
        2014-01-02 09:08:54.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-translationstring.new/python-translationstring.changes
   2015-02-06 22:38:34.000000000 +0100
@@ -1,0 +2,14 @@
+Fri Feb  6 11:07:45 UTC 2015 - [email protected]
+
+- update to version 1.3:
+  - Fix Python 3-specific test failures.
+    Restore compatibility with Python 3.2.
+
+- 1.2 (2014-11-04)
+  - Add support for message contexts.
+  - If the object passed to a TranslationStringFactory __call__ method is
+    itself a translation string, use the passed object’s domain instead of the
+    domain passed to the factory’s contstructor. See
+    https://github.com/Pylons/translationstring/pull/12 .
+
+-------------------------------------------------------------------

Old:
----
  translationstring-1.1.tar.gz

New:
----
  translationstring-1.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-translationstring.spec ++++++
--- /var/tmp/diff_new_pack.NZY9mZ/_old  2015-02-06 22:38:35.000000000 +0100
+++ /var/tmp/diff_new_pack.NZY9mZ/_new  2015-02-06 22:38:35.000000000 +0100
@@ -1,8 +1,8 @@
 #
 # spec file for package python-translationstring
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
-# Copyright (c) 2013 LISA GmbH, Bingen, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 LISA GmbH, Bingen, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,12 +12,13 @@
 # case the license is the MIT License). An "Open Source License" is a
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
-#
+
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 Name:           python-translationstring
-Version:        1.1
+Version:        1.3
 Release:        0
 Url:            http://www.repoze.org
 Summary:        Utility library for i18n relied on by various Repoze and 
Pyramid packages

++++++ translationstring-1.1.tar.gz -> translationstring-1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/CHANGES.txt 
new/translationstring-1.3/CHANGES.txt
--- old/translationstring-1.1/CHANGES.txt       2012-02-08 08:27:25.000000000 
+0100
+++ new/translationstring-1.3/CHANGES.txt       1970-01-01 01:00:00.000000000 
+0100
@@ -1,53 +0,0 @@
-translationstring
-=================
-
-1.1 (2012-02-08)
-----------------
-
-- Add MANIFEST to make sure all files are present in a release. This fixes
-  `ticket 8 <https://github.com/Pylons/translationstring/issues/8>`_.
-
-
-1.0 (2012-02-04)
-----------------
-
-- coerce non-string values to a string during translation, except for None.
-
-- Honour mapping information passed to the translator, combining it with
-  mapping data already part of the translation string.
-  
-- Support formatting of translation strings with %-operator.
-
-0.4 (09-22-2011)
-----------------
-
-- Python 3 compatibility (thanks to Joe Dallago, GSOC student).
-
-- Remove testing dependency on Babel.
-
-- Moved to GitHub (https://github.com/Pylons/translationstring).
-
-- Added tox.ini for testing purposes.
-
-0.3 (06-25-2010)
-----------------
-
-- Preserve default translations even if they are an empty string. This
-  fixes problems with Chameleon being unable to determine if a translation
-  is present or not.
-
-0.2 (04-25-2010)
-----------------
-
-- Add ``__getstate__`` and ``__reduce__`` methods to translation
-  string to allow for pickling.
-
-- Fix bug in ChameleonTranslate.  When ``i18n:translate`` was used in
-  templates, a translation string was inappropriately created with a
-  ``default`` value of the empty string.  Symptom: template text would
-  "disappear" rather than being returned untranslated.
-
-0.1 (04-24-2010)
-----------------
-
-- Initial release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/PKG-INFO 
new/translationstring-1.3/PKG-INFO
--- old/translationstring-1.1/PKG-INFO  2012-02-08 08:28:01.000000000 +0100
+++ new/translationstring-1.3/PKG-INFO  2014-11-05 21:19:29.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: translationstring
-Version: 1.1
+Version: 1.3
 Summary: Utility library for i18n relied on by various Repoze and Pyramid 
packages
 Home-page: http://pylonsproject.org
 Author: Chris McDonough, Agendaless Consulting
@@ -27,6 +27,24 @@
         translationstring
         =================
         
+        1.3 (2014-11-05)
+        ----------------
+        
+        - Fix Python 3-specific test failures.
+        
+        - Restore compatibility with Python 3.2.
+        
+        1.2 (2014-11-04)
+        ----------------
+        
+        - Add support for message contexts.
+        
+        - If the object passed to a TranslationStringFactory ``__call__`` 
method is
+          itself a translation string, use the passed object's ``domain`` 
instead of
+          the domain passed to the factory's contstructor.  See
+          https://github.com/Pylons/translationstring/pull/12 .
+        
+        
         1.1 (2012-02-08)
         ----------------
         
@@ -83,12 +101,14 @@
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.4
-Classifier: Programming Language :: Python :: 2.5
 Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Internationalization
 Classifier: Topic :: Software Development :: Localization
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/README.rst 
new/translationstring-1.3/README.rst
--- old/translationstring-1.1/README.rst        1970-01-01 01:00:00.000000000 
+0100
+++ new/translationstring-1.3/README.rst        2014-11-05 21:17:14.000000000 
+0100
@@ -0,0 +1,16 @@
+translationstring
+=================
+
+A library used by various `Pylons Project <http://pylonsproject.org>`_
+packages for internationalization (i18n) duties related to translation.
+
+This package provides a *translation string* class, a *translation
+string factory* class, translation and pluralization primitives, and a
+utility that helps `Chameleon <http://chameleon.repoze.org>`_
+templates use translation facilities of this package.  It does not
+depend on `Babel <http://babel.edgewall.org>`_, but its translation
+and pluralization services are meant to work best when provided with
+an instance of the ``babel.support.Translations`` class.
+
+Please see http://docs.pylonsproject.org/projects/translationstring/dev/ or
+the ``docs/index.rst`` file in this package for the documentation.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/README.txt 
new/translationstring-1.3/README.txt
--- old/translationstring-1.1/README.txt        2012-02-08 08:26:52.000000000 
+0100
+++ new/translationstring-1.3/README.txt        1970-01-01 01:00:00.000000000 
+0100
@@ -1,16 +0,0 @@
-translationstring
-=================
-
-A library used by various `Pylons Project <http://pylonsproject.org>`_
-packages for internationalization (i18n) duties related to translation.
-
-This package provides a *translation string* class, a *translation
-string factory* class, translation and pluralization primitives, and a
-utility that helps `Chameleon <http://chameleon.repoze.org>`_
-templates use translation facilities of this package.  It does not
-depend on `Babel <http://babel.edgewall.org>`_, but its translation
-and pluralization services are meant to work best when provided with
-an instance of the ``babel.support.Translations`` class.
-
-Please see http://docs.pylonsproject.org/projects/translationstring/dev/ or
-the ``docs/index.rst`` file in this package for the documentation.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/setup.cfg 
new/translationstring-1.3/setup.cfg
--- old/translationstring-1.1/setup.cfg 2012-02-08 08:28:01.000000000 +0100
+++ new/translationstring-1.3/setup.cfg 2014-11-05 21:19:29.000000000 +0100
@@ -8,6 +8,9 @@
 cover-package = translationstring
 cover-erase = 1
 
+[bdist_wheel]
+universal = 1
+
 [egg_info]
 tag_build = 
 tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/setup.py 
new/translationstring-1.3/setup.py
--- old/translationstring-1.1/setup.py  2012-02-08 08:27:31.000000000 +0100
+++ new/translationstring-1.3/setup.py  2014-11-05 21:18:44.000000000 +0100
@@ -6,14 +6,14 @@
 here = os.path.abspath(os.path.dirname(__file__))
 
 try:
-    README = open(os.path.join(here, 'README.txt')).read()
-    CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
+    README = open(os.path.join(here, 'README.rst')).read()
+    CHANGES = open(os.path.join(here, 'changes.rst')).read()
 except:
     README = ''
     CHANGES = ''
 
 setup(name='translationstring',
-      version='1.1',
+      version='1.3',
       description=('Utility library for i18n relied on by various Repoze '
                    'and Pyramid packages'),
       long_description=README + '\n\n' +  CHANGES,
@@ -21,12 +21,14 @@
           "Development Status :: 5 - Production/Stable",
           "Intended Audience :: Developers",
           "Programming Language :: Python :: 2",
-          "Programming Language :: Python :: 2.4",
-          "Programming Language :: Python :: 2.5",
           "Programming Language :: Python :: 2.6",
           "Programming Language :: Python :: 2.7",
           "Programming Language :: Python :: 3",
           "Programming Language :: Python :: 3.2",
+          "Programming Language :: Python :: 3.3",
+          "Programming Language :: Python :: 3.4",
+          "Programming Language :: Python :: Implementation :: CPython",
+          "Programming Language :: Python :: Implementation :: PyPy",
           "Topic :: Software Development :: Libraries :: Python Modules",
           "Topic :: Software Development :: Internationalization",
           "Topic :: Software Development :: Localization",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/tox.ini 
new/translationstring-1.3/tox.ini
--- old/translationstring-1.1/tox.ini   2012-02-08 08:26:52.000000000 +0100
+++ new/translationstring-1.3/tox.ini   2014-11-05 21:17:14.000000000 +0100
@@ -1,6 +1,6 @@
 [tox]
 envlist = 
-    py24,py25,py26,py27,py32,jython,pypy,cover
+    py26,py27,py32,jython,pypy,cover
 
 [testenv]
 commands = 
@@ -14,7 +14,7 @@
 
 [testenv:cover]
 basepython =
-    python2.6
+    python2.7
 commands = 
     python setup.py nosetests --with-xunit --with-xcoverage
 deps = 
@@ -27,4 +27,3 @@
 # cobertura jenkins reporting and b) pypy and jython can't handle any
 # combination of versions of coverage and nosexcover that i can find.
 # coverage==3.4 is required by nosexcover.
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translationstring-1.1/translationstring/__init__.py 
new/translationstring-1.3/translationstring/__init__.py
--- old/translationstring-1.1/translationstring/__init__.py     2012-02-08 
08:26:52.000000000 +0100
+++ new/translationstring-1.3/translationstring/__init__.py     2014-11-05 
21:17:14.000000000 +0100
@@ -9,6 +9,8 @@
 _interp_regex = re.compile(r'(?<!\$)(\$(?:(%(n)s)|{(%(n)s)}))'
     % ({'n': NAME_RE}))
 
+CONTEXT_MASK = text_type('%s\x04%s')
+
 class TranslationString(text_type):
     """
     The constructor for a :term:`translation string`.  A translation
@@ -30,7 +32,7 @@
     ``default`` represents an explicit *default text* for this
     translation string.  Default text appears when the translation
     string cannot be translated.  Usually, the ``msgid`` of a
-    translation string serves double duty as as its default text.
+    translation string serves double duty as its default text.
     However, using this option you can provide a different default
     text for this translation string.  This feature is useful when the
     default of a translation string is too complicated or too long to
@@ -45,6 +47,9 @@
     string` *replacement marker* instances found within the ``msgid``
     (or ``default``) value of this translation string.
 
+    ``context`` represents the :term:`translation context`.  By default,
+    the translation context is ``None``.
+
     After a translation string is constructed, it behaves like most
     other ``unicode`` objects; its ``msgid`` value will be displayed
     when it is treated like a ``unicode`` object.  Only when its
@@ -56,9 +61,9 @@
     ``mapping`` attribute.  The object otherwise behaves much like a
     Unicode string.
     """
-    __slots__ = ('domain', 'default', 'mapping')
+    __slots__ = ('domain', 'context', 'default', 'mapping')
 
-    def __new__(self, msgid, domain=None, default=None, mapping=None):
+    def __new__(self, msgid, domain=None, default=None, mapping=None, 
context=None):
 
         # NB: this function should never never lose the *original
         # identity* of a non-``None`` but empty ``default`` value
@@ -67,10 +72,12 @@
         self = text_type.__new__(self, msgid)
         if isinstance(msgid, self.__class__):
             domain = domain or msgid.domain and msgid.domain[:]
+            context = context or msgid.context and msgid.context[:]
             default = default or msgid.default and msgid.default[:]
             mapping = mapping or msgid.mapping and msgid.mapping.copy()
             msgid = text_type(msgid)
         self.domain = domain
+        self.context = context
         if default is None:
             default = text_type(msgid)
         self.default = default
@@ -97,7 +104,7 @@
     def interpolate(self, translated=None):
         """ Interpolate the value ``translated`` which is assumed to
         be a Unicode object containing zero or more *replacement
-        markers* (``${foo}`` or ``${bar}``) using the ``mapping``
+        markers* (``$foo`` or ``${bar}``) using the ``mapping``
         dictionary attached to this instance.  If the ``mapping``
         dictionary is empty or ``None``, no interpolation is
         performed.
@@ -111,7 +118,7 @@
         # NB: this function should never never lose the *original
         # identity* of a non-``None`` but empty ``default`` value it
         # is provided.  If (translated == default) , it should return the
-        # *orignal* default, not a derivation.  See the comment below in
+        # *original* default, not a derivation.  See the comment below in
         # ChameleonTranslate.
 
         if self.mapping and translated:
@@ -126,9 +133,9 @@
         return self.__class__, self.__getstate__()
 
     def __getstate__(self):
-        return text_type(self), self.domain, self.default, self.mapping
+        return text_type(self), self.domain, self.default, self.mapping, 
self.context
 
-def TranslationStringFactory(domain):
+def TranslationStringFactory(factory_domain):
     """ Create a factory which will generate translation strings
     without requiring that each call to the factory be passed a
     ``domain`` value.  A single argument is passed to this class'
@@ -139,12 +146,20 @@
     ``__call__`` method of an instance of this class have the meaning
     as described by the constructor of the
     :class:`translationstring.TranslationString`"""
-    def create(msgid, mapping=None, default=None):
+    def create(msgid, mapping=None, default=None, context=None):
         """ Provided a msgid (Unicode object or :term:`translation
         string`) and optionally a mapping object, and a *default
         value*, return a :term:`translation string` object."""
+
+        # if we are passing in a TranslationString as the msgid, then
+        # use its domain
+        if isinstance(msgid, TranslationString):
+            domain = msgid.domain or factory_domain
+        else:
+            domain = factory_domain
+
         return TranslationString(msgid, domain=domain, default=default,
-                                 mapping=mapping)
+                                 mapping=mapping, context=context)
     return create
 
 def ChameleonTranslate(translator):
@@ -202,8 +217,7 @@
         tstring = msgid
 
         if not hasattr(tstring, 'interpolate'):
-            tstring = TranslationString(msgid, domain, default, mapping)
-
+            tstring = TranslationString(msgid, domain, default, mapping, 
context)
         if translator is None:
             result = tstring.interpolate()
         else:
@@ -213,7 +227,7 @@
 
     return translate
 
-def ugettext_policy(translations, tstring, domain):
+def ugettext_policy(translations, tstring, domain, context):
     """ A translator policy function which unconditionally uses the
     ``ugettext`` API on the translations object."""
 
@@ -222,24 +236,39 @@
     else: # pragma: no cover
         _gettext = translations.ugettext
 
-    return _gettext(tstring)
+    if context:
+       # Workaround for http://bugs.python.org/issue2504?
+        msgid = CONTEXT_MASK % (context, tstring)
+    else:
+        msgid = tstring
+
+    translated = _gettext(msgid)
+    return tstring if translated == msgid else translated
 
-def dugettext_policy(translations, tstring, domain):
+def dugettext_policy(translations, tstring, domain, context):
     """ A translator policy function which assumes the use of a
     :class:`babel.support.Translations` translations object, which
     supports the dugettext API; fall back to ugettext."""
     if domain is None:
         default_domain = getattr(translations, 'domain', None) or 'messages'
         domain = getattr(tstring, 'domain', None) or default_domain
-    if getattr(translations, 'dugettext', None) is not None:
-        return translations.dugettext(domain, tstring)
+    context = context or getattr(tstring, 'context', None)
+    if context:
+       # Workaround for http://bugs.python.org/issue2504?
+        msgid = CONTEXT_MASK % (context, tstring)
+    else:
+        msgid = tstring
 
-    if PY3: # pragma: no cover
-        _gettext = translations.gettext
-    else: # pragma: no cover
-        _gettext = translations.ugettext
+    if getattr(translations, 'dugettext', None) is not None:
+        translated = translations.dugettext(domain, msgid)
+    else:
+        if PY3: # pragma: no cover
+            _gettext = translations.gettext
+        else: # pragma: no cover
+            _gettext = translations.ugettext
 
-    return _gettext(tstring)
+        translated = _gettext(msgid)
+    return tstring if translated == msgid else translated
 
 def Translator(translations=None, policy=None):
     """
@@ -269,19 +298,21 @@
     """
     if policy is None:
         policy = dugettext_policy
-    def translator(tstring, domain=None, mapping=None):
+    def translator(tstring, domain=None, mapping=None, context=None):
         if not hasattr(tstring, 'interpolate'):
-            tstring = TranslationString(tstring, domain=domain, 
mapping=mapping)
+            tstring = TranslationString(tstring, domain=domain, 
mapping=mapping, context=context)
         elif mapping:
             if tstring.mapping:
                 new_mapping = tstring.mapping.copy()
                 new_mapping.update(mapping)
             else:
                 new_mapping = mapping
-            tstring = TranslationString(tstring, domain=domain, 
mapping=new_mapping)
+            tstring = TranslationString(tstring, domain=domain, 
mapping=new_mapping, context=context)
         translated = tstring
+        domain = domain or tstring.domain
+        context = context or tstring.context
         if translations is not None:
-            translated = policy(translations, tstring, domain)
+            translated = policy(translations, tstring, domain, context)
         if translated == tstring:
             translated = tstring.default
         if translated and '$' in translated and tstring.mapping:
@@ -289,7 +320,7 @@
         return translated
     return translator
 
-def ungettext_policy(translations, singular, plural, n, domain):
+def ungettext_policy(translations, singular, plural, n, domain, context):
     """ A pluralizer policy function which unconditionally uses the
     ``ungettext`` API on the translations object."""
 
@@ -298,25 +329,37 @@
     else: # pragma: no cover
         _gettext = translations.ungettext
 
-    return _gettext(singular, plural, n)
+    if context:
+       # Workaround for http://bugs.python.org/issue2504?
+        msgid = CONTEXT_MASK % (context, singular)
+    else:
+        msgid = singular
 
-def dungettext_policy(translations, singular, plural, n, domain):
+    translated = _gettext(msgid, plural, n)
+    return singular if translated == msgid else translated
+
+def dungettext_policy(translations, singular, plural, n, domain, context):
     """ A pluralizer policy function which assumes the use of the
     :class:`babel.support.Translations` class, which supports the
     dungettext API; falls back to ungettext."""
 
     default_domain = getattr(translations, 'domain', None) or 'messages'
     domain = domain or default_domain
-
+    if context:
+       # Workaround for http://bugs.python.org/issue2504?
+        msgid = CONTEXT_MASK % (context, singular)
+    else:
+        msgid = singular
     if getattr(translations, 'dungettext', None) is not None:
-        return translations.dungettext(domain, singular, plural, n)
-
-    if PY3: # pragma: no cover
-        _gettext = translations.ngettext
-    else: # pragma: no cover
-        _gettext = translations.ungettext
+        translated = translations.dungettext(domain, msgid, plural, n)
+    else:
+        if PY3: # pragma: no cover
+            _gettext = translations.ngettext
+        else: # pragma: no cover
+            _gettext = translations.ungettext
 
-    return _gettext(singular, plural, n)
+        translated = _gettext(msgid, plural, n)
+    return singular if translated == msgid else translated
 
 def Pluralizer(translations=None, policy=None):
     """
@@ -352,10 +395,10 @@
         policy = dungettext_policy
     if translations is None:
         translations = NullTranslations()
-    def pluralizer(singular, plural, n, domain=None, mapping=None):
+    def pluralizer(singular, plural, n, domain=None, mapping=None, 
context=None):
         """ Pluralize this object """
         translated = text_type(
-            policy(translations, singular, plural, n, domain))
+            policy(translations, singular, plural, n, domain, context))
         if translated and '$' in translated and mapping:
             return TranslationString(translated, mapping=mapping).interpolate()
         return translated
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/translationstring-1.1/translationstring/tests/test__init__.py 
new/translationstring-1.3/translationstring/tests/test__init__.py
--- old/translationstring-1.1/translationstring/tests/test__init__.py   
2012-02-08 08:26:52.000000000 +0100
+++ new/translationstring-1.3/translationstring/tests/test__init__.py   
2014-11-05 21:17:14.000000000 +0100
@@ -118,14 +118,14 @@
                              mapping='mapping')
         result = inst.__reduce__()
         self.assertEqual(result, (klass, (u('msgid'), 'domain', u('default'), 
-                                          'mapping')))
+                                          'mapping', None)))
 
     def test___getstate__(self):
         inst = self._makeOne('msgid', default='default', domain='domain',
                              mapping='mapping')
         result = inst.__getstate__()
         self.assertEqual(result,
-                         (u('msgid'), 'domain', u('default'), 'mapping'))
+                         (u('msgid'), 'domain', u('default'), 'mapping', None))
 
 class TestTranslationStringFactory(unittest.TestCase):
     def _makeOne(self, domain):
@@ -140,6 +140,27 @@
         self.assertEqual(inst.mapping, 'mapping')
         self.assertEqual(inst.default, 'default')
 
+    def test_msgid_is_translation_string_override_domain(self):
+        user_factory = self._makeOne('user')
+        factory = self._makeOne('budge')
+
+        wrapped_inst = user_factory('wrapped_msgid', mapping={'a':1}, 
default='default')
+        wrapper_inst = factory(wrapped_inst)
+
+        self.assertEqual(str(wrapper_inst), 'wrapped_msgid')
+        self.assertEqual(wrapper_inst.domain, 'user')
+
+    def test_msgid_is_translation_string_override_kwarg(self):
+        user_factory = self._makeOne('user')
+        factory = self._makeOne('budge')
+
+        wrapped_inst = user_factory('wrapped_msgid', mapping={'a':1}, 
default='default')
+        wrapper_inst = factory(wrapped_inst, mapping={'b':1}, 
default='other_default')
+
+        self.assertEqual(str(wrapper_inst), 'wrapped_msgid')
+        self.assertEqual(wrapper_inst.mapping, {'b':1})
+        self.assertEqual(wrapper_inst.default, 'other_default')
+
 
 class TestChameleonTranslate(unittest.TestCase):
     def _makeOne(self, translator):
@@ -232,7 +253,7 @@
 
     def test_policy_returns_msgid(self):
         tstring = DummyTranslationString('msgid', default='default')
-        def policy(translations, msg, domain):
+        def policy(translations, msg, domain, context):
             return msg
         inst = self._makeOne('ignoreme', policy)
         result = inst(tstring)
@@ -240,7 +261,7 @@
 
     def test_policy_returns_translation(self):
         tstring = DummyTranslationString('msgid')
-        def policy(translations, msg, domain):
+        def policy(translations, msg, domain, context):
             return 'translated'
         inst = self._makeOne('ignoreme', policy)
         result = inst(tstring)
@@ -263,7 +284,7 @@
 
     def test_policy_returns_translated(self):
         translations = DummyTranslations('result')
-        def policy(translations, singular, plural, n, domain):
+        def policy(translations, singular, plural, n, domain, context):
             return 'translated'
         inst = self._makeOne(translations, policy)
         tstring = DummyTranslationString('msgid')
@@ -271,19 +292,31 @@
         self.assertEqual(result, 'translated')
 
 class Test_ugettext_policy(unittest.TestCase):
-    def _callFUT(self, translations, tstring, domain):
+    def _callFUT(self, translations, tstring, domain, context):
         from translationstring import ugettext_policy
-        return ugettext_policy(translations, tstring, domain)
+        return ugettext_policy(translations, tstring, domain, context)
 
     def test_it(self):
         translations = DummyTranslations('result')
-        result = self._callFUT(translations, 'string', None)
+        result = self._callFUT(translations, 'string', None, None)
+        self.assertEqual(result, 'result')
+
+    def test_msgctxt(self):
+        translations = DummyTranslations('result')
+        result = self._callFUT(translations, u('p\xf8f'), None, 'button')
+        self.assertEqual(translations.params, (u('button\x04p\xf8f'),))
         self.assertEqual(result, 'result')
 
+    def test_msgctxt_no_translation_found(self):
+        input = u('p\xf8f')
+        translations = DummyTranslations(input)
+        result = self._callFUT(translations, input, None, 'button')
+        self.assertEqual(result, u('p\xf8f'))
+
 class Test_dugettext_policy(unittest.TestCase):
-    def _callFUT(self, translations, tstring, domain):
+    def _callFUT(self, translations, tstring, domain, context=None):
         from translationstring import dugettext_policy
-        return dugettext_policy(translations, tstring, domain)
+        return dugettext_policy(translations, tstring, domain, context)
 
     def test_it_use_default_domain(self):
         translations = DummyTranslations('result', domain=None)
@@ -320,22 +353,54 @@
         result = self._callFUT(translations, tstring, None)
         self.assertEqual(result, 'result')
 
+    def test_msgctxt_from_tstring(self):
+        translations = DummyTranslations('result')
+        tstring = DummyTranslationString(u('p\xf8f'), context='button')
+        result = self._callFUT(translations, tstring, None)
+        self.assertEqual(translations.params, ('messages', 
u('button\x04p\xf8f'),))
+        self.assertEqual(result, 'result')
+
+    def test_msgctxt_override(self):
+        translations = DummyTranslations('result')
+        tstring = DummyTranslationString(u('p\xf8f'), context='other')
+        result = self._callFUT(translations, tstring, None, context='button')
+        self.assertEqual(translations.params, ('messages', 
u('button\x04p\xf8f'),))
+        self.assertEqual(result, 'result')
+
+    def test_msgctxt_no_translation_found(self):
+        translations = DummyTranslations(u('button\x04p\xf8f'))
+        tstring = DummyTranslationString(u('p\xf8f'), context='button')
+        result = self._callFUT(translations, tstring, None)
+        self.assertEqual(result, u('p\xf8f'))
+
 class Test_ungettext_policy(unittest.TestCase):
     def _callFUT(self, translations, singular, plural, n, domain=None,
-                 mapping=None):
+                 mapping=None, context=None):
         from translationstring import ungettext_policy
-        return ungettext_policy(translations, singular, plural, n, domain)
+        return ungettext_policy(translations, singular, plural, n, domain, 
context)
 
     def test_it(self):
         translations = DummyTranslations('result')
         result = self._callFUT(translations, 'singular', 'plural', 1)
         self.assertEqual(result, 'result')
 
+    def test_msgctxt(self):
+        translations = DummyTranslations('result')
+        result = self._callFUT(translations, u('p\xf8f'), 'plural', 1, 
context='button')
+        self.assertEqual(translations.params, (u('button\x04p\xf8f'), 
'plural', 1))
+        self.assertEqual(result, 'result')
+
+    def test_msgctxt_no_translation(self):
+        translations = DummyTranslations(u('button\x04p\xf8f'))
+        result = self._callFUT(translations, u('p\xf8f'), 'plural', 1, 
context='button')
+        self.assertEqual(translations.params, (u('button\x04p\xf8f'), 
'plural', 1))
+        self.assertEqual(result, u('p\xf8f'))
+
 class Test_dungettext_policy(unittest.TestCase):
     def _callFUT(self, translations, singular, plural, n, domain=None,
-                 mapping=None):
+                 mapping=None, context=None):
         from translationstring import dungettext_policy
-        return dungettext_policy(translations, singular, plural, n, domain)
+        return dungettext_policy(translations, singular, plural, n, domain, 
context)
 
     def test_it_use_default_domain(self):
         translations = DummyTranslations('result')
@@ -367,30 +432,37 @@
         self.domain = domain
         
     def gettext(self, tstring): # pragma: no cover
+        self.params = (tstring,)
         return self.result
     
     def ngettext(self, singular, plural, n): # pragma: no cover
+        self.params = (singular, plural, n)
         return self.result
 
     def ugettext(self, tstring): # pragma: no cover
+        self.params = (tstring,)
         return self.result
 
     def dugettext(self, domain, tstring): # pragma: no cover
+        self.params = (domain, tstring)
         self.asked_domain = domain
         return self.result
 
     def ungettext(self, singular, plural, n): # pragma: no cover
+        self.params = (singular, plural, n)
         return self.result
 
     def dungettext(self, domain, singular, plural, n): # pragma: no cover
+        self.params = (domain, singular, plural, n)
         self.asked_domain = domain
         return self.result
 
 class DummyTranslationString(text_type):
-    def __new__(cls, msgid='', domain=None, default=None, mapping=None):
+    def __new__(cls, msgid='', domain=None, default=None, mapping=None, 
context=None):
         self = text_type.__new__(cls, msgid)
         text_type.__init__(self, msgid)
         self.domain = domain
+        self.context = context
         self.mapping = mapping
         if default is None:
             default = msgid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/translationstring-1.1/translationstring.egg-info/PKG-INFO 
new/translationstring-1.3/translationstring.egg-info/PKG-INFO
--- old/translationstring-1.1/translationstring.egg-info/PKG-INFO       
2012-02-08 08:28:01.000000000 +0100
+++ new/translationstring-1.3/translationstring.egg-info/PKG-INFO       
2014-11-05 21:19:29.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: translationstring
-Version: 1.1
+Version: 1.3
 Summary: Utility library for i18n relied on by various Repoze and Pyramid 
packages
 Home-page: http://pylonsproject.org
 Author: Chris McDonough, Agendaless Consulting
@@ -27,6 +27,24 @@
         translationstring
         =================
         
+        1.3 (2014-11-05)
+        ----------------
+        
+        - Fix Python 3-specific test failures.
+        
+        - Restore compatibility with Python 3.2.
+        
+        1.2 (2014-11-04)
+        ----------------
+        
+        - Add support for message contexts.
+        
+        - If the object passed to a TranslationStringFactory ``__call__`` 
method is
+          itself a translation string, use the passed object's ``domain`` 
instead of
+          the domain passed to the factory's contstructor.  See
+          https://github.com/Pylons/translationstring/pull/12 .
+        
+        
         1.1 (2012-02-08)
         ----------------
         
@@ -83,12 +101,14 @@
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.4
-Classifier: Programming Language :: Python :: 2.5
 Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Internationalization
 Classifier: Topic :: Software Development :: Localization
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/translationstring-1.1/translationstring.egg-info/SOURCES.txt 
new/translationstring-1.3/translationstring.egg-info/SOURCES.txt
--- old/translationstring-1.1/translationstring.egg-info/SOURCES.txt    
2012-02-08 08:28:01.000000000 +0100
+++ new/translationstring-1.3/translationstring.egg-info/SOURCES.txt    
2014-11-05 21:19:29.000000000 +0100
@@ -1,9 +1,8 @@
-CHANGES.txt
 CONTRIBUTORS.txt
 COPYRIGHT.txt
 LICENSE.txt
 MANIFEST.in
-README.txt
+README.rst
 setup.cfg
 setup.py
 tox.ini

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to