Hello community,

here is the log from the commit of package python3-MarkupSafe for 
openSUSE:Factory checked in at 2014-05-09 06:58:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-MarkupSafe (Old)
 and      /work/SRC/openSUSE:Factory/.python3-MarkupSafe.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python3-MarkupSafe"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-MarkupSafe/python3-MarkupSafe.changes    
2013-06-21 19:01:22.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.python3-MarkupSafe.new/python3-MarkupSafe.changes   
    2014-05-09 06:58:31.000000000 +0200
@@ -1,0 +2,12 @@
+Thu May  8 13:51:56 UTC 2014 - [email protected]
+
+- Update to 0.21
+  + No upstream changelog
+- update to 0.19:
+  + Various Python 3.x fixes
+- update to 0.18:
+  + Fixed interpolation on tuples
+  + Varios Python 3.x fixes
+- Require python-setuptools instead of distribute (upstreams merged)
+  
+-------------------------------------------------------------------

Old:
----
  MarkupSafe-0.15.tar.gz

New:
----
  MarkupSafe-0.21.tar.gz

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

Other differences:
------------------
++++++ python3-MarkupSafe.spec ++++++
--- /var/tmp/diff_new_pack.MVeHUU/_old  2014-05-09 06:58:31.000000000 +0200
+++ /var/tmp/diff_new_pack.MVeHUU/_new  2014-05-09 06:58:31.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python3-MarkupSafe
 #
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 20124 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,10 +16,9 @@
 #
 
 
-
 Name:           python3-MarkupSafe
-Version:        0.15
-Release:        1
+Version:        0.21
+Release:        0
 Url:            http://dev.pocoo.org/
 Summary:        Implements a XML/HTML/XHTML Markup safe string for Python
 License:        BSD-3-Clause
@@ -28,15 +27,9 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  python3
 BuildRequires:  python3-devel
-BuildRequires:  python3-distribute
+BuildRequires:  python3-setuptools
 BuildRequires:  python3-2to3
 
-%if 0%{?suse_version} <= 1140
-%{!?python3_sitearch: %global python3_sitearch %(python3 -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
-%{!?py3_ver: %global py3_ver %(python3 -c "import sys; 
version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); 
print(version)")}
-%endif
-Requires:       python(abi) = %{py3_ver}
-
 %description
 Implements a unicode subclass that supports HTML strings. This can be used to
 safely encode strings for dynamically generated web pages.
@@ -57,6 +50,6 @@
 %defattr(-,root,root,-)
 %doc AUTHORS LICENSE README.rst
 %{python3_sitearch}/markupsafe
-%{python3_sitearch}/MarkupSafe-%{version}-py%{py3_ver}.egg-info
+%{python3_sitearch}/MarkupSafe-%{version}-py*.egg-info
 
 %changelog

++++++ MarkupSafe-0.15.tar.gz -> MarkupSafe-0.21.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/MarkupSafe.egg-info/PKG-INFO 
new/MarkupSafe-0.21/MarkupSafe.egg-info/PKG-INFO
--- old/MarkupSafe-0.15/MarkupSafe.egg-info/PKG-INFO    2011-07-20 
10:58:11.000000000 +0200
+++ new/MarkupSafe-0.21/MarkupSafe.egg-info/PKG-INFO    2014-04-17 
11:50:53.000000000 +0200
@@ -1,8 +1,8 @@
 Metadata-Version: 1.0
 Name: MarkupSafe
-Version: 0.15
+Version: 0.21
 Summary: Implements a XML/HTML/XHTML Markup safe string for Python
-Home-page: http://dev.pocoo.org/
+Home-page: http://github.com/mitsuhiko/markupsafe
 Author: Armin Ronacher
 Author-email: [email protected]
 License: BSD
@@ -20,7 +20,8 @@
         
         If you want to make an object unicode that is not yet unicode
         but don't want to lose the taint information, you can use the
-        `soft_unicode` function:
+        `soft_unicode` function.  (On Python 3 you can also use `soft_str` 
which
+        is a different name for the same function).
         
         >>> from markupsafe import soft_unicode
         >>> soft_unicode(42)
@@ -28,6 +29,9 @@
         >>> soft_unicode(Markup('foo'))
         Markup(u'foo')
         
+        HTML Representations
+        --------------------
+        
         Objects can customize their HTML markup equivalent by overriding
         the `__html__` function:
         
@@ -40,6 +44,9 @@
         >>> Markup(Foo())
         Markup(u'<strong>Nice</strong>')
         
+        Silent Escapes
+        --------------
+        
         Since MarkupSafe 0.10 there is now also a separate escape function
         called `escape_silent` that returns an empty string for `None` for
         consistency with other systems that return empty strings for `None`
@@ -57,6 +64,48 @@
                 def escape(cls, s):
                     return cls(escape(s))
         
+        New-Style String Formatting
+        ---------------------------
+        
+        Starting with MarkupSafe 0.21 new style string formats from Python 2.6 
and
+        3.x are now fully supported.  Previously the escape behavior of those
+        functions was spotty at best.  The new implementations operates under 
the
+        following algorithm:
+        
+        1.  if an object has an ``__html_format__`` method it is called as
+            replacement for ``__format__`` with the format specifier.  It 
either
+            has to return a string or markup object.
+        2.  if an object has an ``__html__`` method it is called.
+        3.  otherwise the default format system of Python kicks in and the 
result
+            is HTML escaped.
+        
+        Here is how you can implement your own formatting:
+        
+            class User(object):
+        
+                def __init__(self, id, username):
+                    self.id = id
+                    self.username = username
+        
+                def __html_format__(self, format_spec):
+                    if format_spec == 'link':
+                        return Markup('<a href="/user/{0}">{1}</a>').format(
+                            self.id,
+                            self.__html__(),
+                        )
+                    elif format_spec:
+                        raise ValueError('Invalid format spec')
+                    return self.__html__()
+        
+                def __html__(self):
+                    return Markup('<span 
class=user>{0}</span>').format(self.username)
+        
+        And to format that user:
+        
+        >>> user = User(1, 'foo')
+        >>> Markup('<p>User: {0:link}').format(user)
+        Markup(u'<p>User: <a href="/user/1"><span class=user>foo</span></a>')
+        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/MarkupSafe.egg-info/SOURCES.txt 
new/MarkupSafe-0.21/MarkupSafe.egg-info/SOURCES.txt
--- old/MarkupSafe-0.15/MarkupSafe.egg-info/SOURCES.txt 2011-07-20 
10:58:12.000000000 +0200
+++ new/MarkupSafe-0.21/MarkupSafe.egg-info/SOURCES.txt 2014-04-17 
11:50:53.000000000 +0200
@@ -9,6 +9,7 @@
 MarkupSafe.egg-info/not-zip-safe
 MarkupSafe.egg-info/top_level.txt
 markupsafe/__init__.py
+markupsafe/_compat.py
 markupsafe/_constants.py
 markupsafe/_native.py
 markupsafe/_speedups.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/PKG-INFO new/MarkupSafe-0.21/PKG-INFO
--- old/MarkupSafe-0.15/PKG-INFO        2011-07-20 10:58:12.000000000 +0200
+++ new/MarkupSafe-0.21/PKG-INFO        2014-04-17 11:50:53.000000000 +0200
@@ -1,8 +1,8 @@
 Metadata-Version: 1.0
 Name: MarkupSafe
-Version: 0.15
+Version: 0.21
 Summary: Implements a XML/HTML/XHTML Markup safe string for Python
-Home-page: http://dev.pocoo.org/
+Home-page: http://github.com/mitsuhiko/markupsafe
 Author: Armin Ronacher
 Author-email: [email protected]
 License: BSD
@@ -20,7 +20,8 @@
         
         If you want to make an object unicode that is not yet unicode
         but don't want to lose the taint information, you can use the
-        `soft_unicode` function:
+        `soft_unicode` function.  (On Python 3 you can also use `soft_str` 
which
+        is a different name for the same function).
         
         >>> from markupsafe import soft_unicode
         >>> soft_unicode(42)
@@ -28,6 +29,9 @@
         >>> soft_unicode(Markup('foo'))
         Markup(u'foo')
         
+        HTML Representations
+        --------------------
+        
         Objects can customize their HTML markup equivalent by overriding
         the `__html__` function:
         
@@ -40,6 +44,9 @@
         >>> Markup(Foo())
         Markup(u'<strong>Nice</strong>')
         
+        Silent Escapes
+        --------------
+        
         Since MarkupSafe 0.10 there is now also a separate escape function
         called `escape_silent` that returns an empty string for `None` for
         consistency with other systems that return empty strings for `None`
@@ -57,6 +64,48 @@
                 def escape(cls, s):
                     return cls(escape(s))
         
+        New-Style String Formatting
+        ---------------------------
+        
+        Starting with MarkupSafe 0.21 new style string formats from Python 2.6 
and
+        3.x are now fully supported.  Previously the escape behavior of those
+        functions was spotty at best.  The new implementations operates under 
the
+        following algorithm:
+        
+        1.  if an object has an ``__html_format__`` method it is called as
+            replacement for ``__format__`` with the format specifier.  It 
either
+            has to return a string or markup object.
+        2.  if an object has an ``__html__`` method it is called.
+        3.  otherwise the default format system of Python kicks in and the 
result
+            is HTML escaped.
+        
+        Here is how you can implement your own formatting:
+        
+            class User(object):
+        
+                def __init__(self, id, username):
+                    self.id = id
+                    self.username = username
+        
+                def __html_format__(self, format_spec):
+                    if format_spec == 'link':
+                        return Markup('<a href="/user/{0}">{1}</a>').format(
+                            self.id,
+                            self.__html__(),
+                        )
+                    elif format_spec:
+                        raise ValueError('Invalid format spec')
+                    return self.__html__()
+        
+                def __html__(self):
+                    return Markup('<span 
class=user>{0}</span>').format(self.username)
+        
+        And to format that user:
+        
+        >>> user = User(1, 'foo')
+        >>> Markup('<p>User: {0:link}').format(user)
+        Markup(u'<p>User: <a href="/user/1"><span class=user>foo</span></a>')
+        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/README.rst 
new/MarkupSafe-0.21/README.rst
--- old/MarkupSafe-0.15/README.rst      2010-09-07 17:43:12.000000000 +0200
+++ new/MarkupSafe-0.21/README.rst      2014-04-17 11:49:09.000000000 +0200
@@ -12,7 +12,8 @@
 
 If you want to make an object unicode that is not yet unicode
 but don't want to lose the taint information, you can use the
-`soft_unicode` function:
+`soft_unicode` function.  (On Python 3 you can also use `soft_str` which
+is a different name for the same function).
 
 >>> from markupsafe import soft_unicode
 >>> soft_unicode(42)
@@ -20,6 +21,9 @@
 >>> soft_unicode(Markup('foo'))
 Markup(u'foo')
 
+HTML Representations
+--------------------
+
 Objects can customize their HTML markup equivalent by overriding
 the `__html__` function:
 
@@ -32,6 +36,9 @@
 >>> Markup(Foo())
 Markup(u'<strong>Nice</strong>')
 
+Silent Escapes
+--------------
+
 Since MarkupSafe 0.10 there is now also a separate escape function
 called `escape_silent` that returns an empty string for `None` for
 consistency with other systems that return empty strings for `None`
@@ -48,3 +55,45 @@
         @classmethod
         def escape(cls, s):
             return cls(escape(s))
+
+New-Style String Formatting
+---------------------------
+
+Starting with MarkupSafe 0.21 new style string formats from Python 2.6 and
+3.x are now fully supported.  Previously the escape behavior of those
+functions was spotty at best.  The new implementations operates under the
+following algorithm:
+
+1.  if an object has an ``__html_format__`` method it is called as
+    replacement for ``__format__`` with the format specifier.  It either
+    has to return a string or markup object.
+2.  if an object has an ``__html__`` method it is called.
+3.  otherwise the default format system of Python kicks in and the result
+    is HTML escaped.
+
+Here is how you can implement your own formatting:
+
+    class User(object):
+
+        def __init__(self, id, username):
+            self.id = id
+            self.username = username
+
+        def __html_format__(self, format_spec):
+            if format_spec == 'link':
+                return Markup('<a href="/user/{0}">{1}</a>').format(
+                    self.id,
+                    self.__html__(),
+                )
+            elif format_spec:
+                raise ValueError('Invalid format spec')
+            return self.__html__()
+
+        def __html__(self):
+            return Markup('<span class=user>{0}</span>').format(self.username)
+
+And to format that user:
+
+>>> user = User(1, 'foo')
+>>> Markup('<p>User: {0:link}').format(user)
+Markup(u'<p>User: <a href="/user/1"><span class=user>foo</span></a>')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/markupsafe/__init__.py 
new/MarkupSafe-0.21/markupsafe/__init__.py
--- old/MarkupSafe-0.15/markupsafe/__init__.py  2010-09-07 17:45:38.000000000 
+0200
+++ new/MarkupSafe-0.21/markupsafe/__init__.py  2014-04-17 11:43:10.000000000 
+0200
@@ -9,7 +9,9 @@
     :license: BSD, see LICENSE for more details.
 """
 import re
-from itertools import imap
+import string
+from markupsafe._compat import text_type, string_types, int_types, \
+     unichr, iteritems, PY2
 
 
 __all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
@@ -19,7 +21,7 @@
 _entity_re = re.compile(r'&([^;]+);')
 
 
-class Markup(unicode):
+class Markup(text_type):
     r"""Marks a string as being safe for inclusion in HTML/XML output without
     needing to be escaped.  This implements the `__html__` interface a couple
     of frameworks and web applications use.  :class:`Markup` is a direct
@@ -68,59 +70,59 @@
         if hasattr(base, '__html__'):
             base = base.__html__()
         if encoding is None:
-            return unicode.__new__(cls, base)
-        return unicode.__new__(cls, base, encoding, errors)
+            return text_type.__new__(cls, base)
+        return text_type.__new__(cls, base, encoding, errors)
 
     def __html__(self):
         return self
 
     def __add__(self, other):
-        if hasattr(other, '__html__') or isinstance(other, basestring):
-            return self.__class__(unicode(self) + unicode(escape(other)))
+        if isinstance(other, string_types) or hasattr(other, '__html__'):
+            return self.__class__(super(Markup, 
self).__add__(self.escape(other)))
         return NotImplemented
 
     def __radd__(self, other):
-        if hasattr(other, '__html__') or isinstance(other, basestring):
-            return self.__class__(unicode(escape(other)) + unicode(self))
+        if hasattr(other, '__html__') or isinstance(other, string_types):
+            return self.escape(other).__add__(self)
         return NotImplemented
 
     def __mul__(self, num):
-        if isinstance(num, (int, long)):
-            return self.__class__(unicode.__mul__(self, num))
+        if isinstance(num, int_types):
+            return self.__class__(text_type.__mul__(self, num))
         return NotImplemented
     __rmul__ = __mul__
 
     def __mod__(self, arg):
         if isinstance(arg, tuple):
-            arg = tuple(imap(_MarkupEscapeHelper, arg))
+            arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
         else:
-            arg = _MarkupEscapeHelper(arg)
-        return self.__class__(unicode.__mod__(self, arg))
+            arg = _MarkupEscapeHelper(arg, self.escape)
+        return self.__class__(text_type.__mod__(self, arg))
 
     def __repr__(self):
         return '%s(%s)' % (
             self.__class__.__name__,
-            unicode.__repr__(self)
+            text_type.__repr__(self)
         )
 
     def join(self, seq):
-        return self.__class__(unicode.join(self, imap(escape, seq)))
-    join.__doc__ = unicode.join.__doc__
+        return self.__class__(text_type.join(self, map(self.escape, seq)))
+    join.__doc__ = text_type.join.__doc__
 
     def split(self, *args, **kwargs):
-        return map(self.__class__, unicode.split(self, *args, **kwargs))
-    split.__doc__ = unicode.split.__doc__
+        return list(map(self.__class__, text_type.split(self, *args, 
**kwargs)))
+    split.__doc__ = text_type.split.__doc__
 
     def rsplit(self, *args, **kwargs):
-        return map(self.__class__, unicode.rsplit(self, *args, **kwargs))
-    rsplit.__doc__ = unicode.rsplit.__doc__
+        return list(map(self.__class__, text_type.rsplit(self, *args, 
**kwargs)))
+    rsplit.__doc__ = text_type.rsplit.__doc__
 
     def splitlines(self, *args, **kwargs):
-        return map(self.__class__, unicode.splitlines(self, *args, **kwargs))
-    splitlines.__doc__ = unicode.splitlines.__doc__
+        return list(map(self.__class__, text_type.splitlines(self, *args, 
**kwargs)))
+    splitlines.__doc__ = text_type.splitlines.__doc__
 
     def unescape(self):
-        r"""Unescape markup again into an unicode string.  This also resolves
+        r"""Unescape markup again into an text_type string.  This also resolves
         known HTML4 and XHTML entities:
 
         >>> Markup("Main &raquo; <em>About</em>").unescape()
@@ -139,10 +141,10 @@
             except ValueError:
                 pass
             return u''
-        return _entity_re.sub(handle_match, unicode(self))
+        return _entity_re.sub(handle_match, text_type(self))
 
     def striptags(self):
-        r"""Unescape markup into an unicode string and strip all tags.  This
+        r"""Unescape markup into an text_type string and strip all tags.  This
         also resolves known HTML4 and XHTML entities.  Whitespace is
         normalized to one:
 
@@ -163,11 +165,11 @@
             return cls(rv)
         return rv
 
-    def make_wrapper(name):
-        orig = getattr(unicode, name)
+    def make_simple_escaping_wrapper(name):
+        orig = getattr(text_type, name)
         def func(self, *args, **kwargs):
-            args = _escape_argspec(list(args), enumerate(args))
-            _escape_argspec(kwargs, kwargs.iteritems())
+            args = _escape_argspec(list(args), enumerate(args), self.escape)
+            _escape_argspec(kwargs, iteritems(kwargs), self.escape)
             return self.__class__(orig(self, *args, **kwargs))
         func.__name__ = orig.__name__
         func.__doc__ = orig.__doc__
@@ -177,32 +179,61 @@
                   'title', 'lower', 'upper', 'replace', 'ljust', \
                   'rjust', 'lstrip', 'rstrip', 'center', 'strip', \
                   'translate', 'expandtabs', 'swapcase', 'zfill':
-        locals()[method] = make_wrapper(method)
+        locals()[method] = make_simple_escaping_wrapper(method)
 
     # new in python 2.5
-    if hasattr(unicode, 'partition'):
+    if hasattr(text_type, 'partition'):
         def partition(self, sep):
             return tuple(map(self.__class__,
-                             unicode.partition(self, escape(sep))))
+                             text_type.partition(self, self.escape(sep))))
         def rpartition(self, sep):
             return tuple(map(self.__class__,
-                             unicode.rpartition(self, escape(sep))))
+                             text_type.rpartition(self, self.escape(sep))))
 
     # new in python 2.6
-    if hasattr(unicode, 'format'):
-        format = make_wrapper('format')
+    if hasattr(text_type, 'format'):
+        def format(*args, **kwargs):
+            self, args = args[0], args[1:]
+            formatter = EscapeFormatter(self.escape)
+            return self.__class__(formatter.format(self, *args, **kwargs))
+
+        def __html_format__(self, format_spec):
+            if format_spec:
+                raise ValueError('Unsupported format specification '
+                                 'for Markup.')
+            return self
 
     # not in python 3
-    if hasattr(unicode, '__getslice__'):
-        __getslice__ = make_wrapper('__getslice__')
+    if hasattr(text_type, '__getslice__'):
+        __getslice__ = make_simple_escaping_wrapper('__getslice__')
 
-    del method, make_wrapper
+    del method, make_simple_escaping_wrapper
 
 
-def _escape_argspec(obj, iterable):
+if hasattr(text_type, 'format'):
+    class EscapeFormatter(string.Formatter):
+
+        def __init__(self, escape):
+            self.escape = escape
+
+        def format_field(self, value, format_spec):
+            if hasattr(value, '__html_format__'):
+                rv = value.__html_format__(format_spec)
+            elif hasattr(value, '__html__'):
+                if format_spec:
+                    raise ValueError('No format specification allowed '
+                                     'when formatting an object with '
+                                     'its __html__ method.')
+                rv = value.__html__()
+            else:
+                rv = string.Formatter.format_field(self, value, format_spec)
+            return text_type(self.escape(rv))
+
+
+def _escape_argspec(obj, iterable, escape):
     """Helper for various string-wrapped functions."""
     for key, value in iterable:
-        if hasattr(value, '__html__') or isinstance(value, basestring):
+        if hasattr(value, '__html__') or isinstance(value, string_types):
             obj[key] = escape(value)
     return obj
 
@@ -210,13 +241,13 @@
 class _MarkupEscapeHelper(object):
     """Helper for Markup.__mod__"""
 
-    def __init__(self, obj):
+    def __init__(self, obj, escape):
         self.obj = obj
+        self.escape = escape
 
-    __getitem__ = lambda s, x: _MarkupEscapeHelper(s.obj[x])
-    __str__ = lambda s: str(escape(s.obj))
-    __unicode__ = lambda s: unicode(escape(s.obj))
-    __repr__ = lambda s: str(escape(repr(s.obj)))
+    __getitem__ = lambda s, x: _MarkupEscapeHelper(s.obj[x], s.escape)
+    __unicode__ = __str__ = lambda s: text_type(s.escape(s.obj))
+    __repr__ = lambda s: str(s.escape(repr(s.obj)))
     __int__ = lambda s: int(s.obj)
     __float__ = lambda s: float(s.obj)
 
@@ -227,3 +258,7 @@
     from markupsafe._speedups import escape, escape_silent, soft_unicode
 except ImportError:
     from markupsafe._native import escape, escape_silent, soft_unicode
+
+if not PY2:
+    soft_str = soft_unicode
+    __all__.append('soft_str')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/markupsafe/_compat.py 
new/MarkupSafe-0.21/markupsafe/_compat.py
--- old/MarkupSafe-0.15/markupsafe/_compat.py   1970-01-01 01:00:00.000000000 
+0100
+++ new/MarkupSafe-0.21/markupsafe/_compat.py   2014-04-17 11:01:00.000000000 
+0200
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+"""
+    markupsafe._compat
+    ~~~~~~~~~~~~~~~~~~
+
+    Compatibility module for different Python versions.
+
+    :copyright: (c) 2013 by Armin Ronacher.
+    :license: BSD, see LICENSE for more details.
+"""
+import sys
+
+PY2 = sys.version_info[0] == 2
+
+if not PY2:
+    text_type = str
+    string_types = (str,)
+    unichr = chr
+    int_types = (int,)
+    iteritems = lambda x: iter(x.items())
+else:
+    text_type = unicode
+    string_types = (str, unicode)
+    unichr = unichr
+    int_types = (int, long)
+    iteritems = lambda x: x.iteritems()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/markupsafe/_native.py 
new/MarkupSafe-0.21/markupsafe/_native.py
--- old/MarkupSafe-0.15/markupsafe/_native.py   2010-09-07 17:43:12.000000000 
+0200
+++ new/MarkupSafe-0.21/markupsafe/_native.py   2013-05-20 19:45:22.000000000 
+0200
@@ -9,6 +9,7 @@
     :license: BSD, see LICENSE for more details.
 """
 from markupsafe import Markup
+from markupsafe._compat import text_type
 
 
 def escape(s):
@@ -18,7 +19,7 @@
     """
     if hasattr(s, '__html__'):
         return s.__html__()
-    return Markup(unicode(s)
+    return Markup(text_type(s)
         .replace('&', '&amp;')
         .replace('>', '&gt;')
         .replace('<', '&lt;')
@@ -40,6 +41,6 @@
     """Make a string unicode if it isn't already.  That way a markup
     string is not converted back to unicode.
     """
-    if not isinstance(s, unicode):
-        s = unicode(s)
+    if not isinstance(s, text_type):
+        s = text_type(s)
     return s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/markupsafe/tests.py 
new/MarkupSafe-0.21/markupsafe/tests.py
--- old/MarkupSafe-0.15/markupsafe/tests.py     2010-09-07 17:43:12.000000000 
+0200
+++ new/MarkupSafe-0.21/markupsafe/tests.py     2014-04-17 11:48:41.000000000 
+0200
@@ -1,16 +1,19 @@
+# -*- coding: utf-8 -*-
 import gc
 import unittest
 from markupsafe import Markup, escape, escape_silent
+from markupsafe._compat import text_type
 
 
 class MarkupTestCase(unittest.TestCase):
 
-    def test_markup_operations(self):
+    def test_adding(self):
         # adding two strings should escape the unsafe one
         unsafe = '<script 
type="application/x-some-script">alert("foo");</script>'
         safe = Markup('<em>username</em>')
-        assert unsafe + safe == unicode(escape(unsafe)) + unicode(safe)
+        assert unsafe + safe == text_type(escape(unsafe)) + text_type(safe)
 
+    def test_string_interpolation(self):
         # string interpolations are safe to use too
         assert Markup('<em>%s</em>') % '<bad user>' == \
                '<em>&lt;bad user&gt;</em>'
@@ -18,6 +21,10 @@
             'username': '<bad user>'
         } == '<em>&lt;bad user&gt;</em>'
 
+        assert Markup('%i') % 3.14 == '3'
+        assert Markup('%.2f') % 3.14 == '3.14'
+
+    def test_type_behavior(self):
         # an escaped object is markup too
         assert type(Markup('foo') + 'bar') is Markup
 
@@ -25,21 +32,87 @@
         x = Markup("foo")
         assert x.__html__() is x
 
+    def test_html_interop(self):
         # it also knows how to treat __html__ objects
         class Foo(object):
             def __html__(self):
                 return '<em>awesome</em>'
             def __unicode__(self):
                 return 'awesome'
+            __str__ = __unicode__
         assert Markup(Foo()) == '<em>awesome</em>'
         assert Markup('<strong>%s</strong>') % Foo() == \
                '<strong><em>awesome</em></strong>'
 
+    def test_tuple_interpol(self):
+        self.assertEqual(Markup('<em>%s:%s</em>') % (
+            '<foo>',
+            '<bar>',
+        ), Markup(u'<em>&lt;foo&gt;:&lt;bar&gt;</em>'))
+
+    def test_dict_interpol(self):
+        self.assertEqual(Markup('<em>%(foo)s</em>') % {
+            'foo': '<foo>',
+        }, Markup(u'<em>&lt;foo&gt;</em>'))
+        self.assertEqual(Markup('<em>%(foo)s:%(bar)s</em>') % {
+            'foo': '<foo>',
+            'bar': '<bar>',
+        }, Markup(u'<em>&lt;foo&gt;:&lt;bar&gt;</em>'))
+
+    def test_escaping(self):
         # escaping and unescaping
         assert escape('"<>&\'') == '&#34;&lt;&gt;&amp;&#39;'
         assert Markup("<em>Foo &amp; Bar</em>").striptags() == "Foo & Bar"
         assert Markup("&lt;test&gt;").unescape() == "<test>"
 
+    def test_formatting(self):
+        for actual, expected in (
+            (Markup('%i') % 3.14, '3'),
+            (Markup('%.2f') % 3.14159, '3.14'),
+            (Markup('%s %s %s') % ('<', 123, '>'), '&lt; 123 &gt;'),
+            (Markup('<em>{awesome}</em>').format(awesome='<awesome>'),
+             '<em>&lt;awesome&gt;</em>'),
+            (Markup('{0[1][bar]}').format([0, {'bar': '<bar/>'}]),
+             '&lt;bar/&gt;'),
+            (Markup('{0[1][bar]}').format([0, {'bar': Markup('<bar/>')}]),
+             '<bar/>')):
+            assert actual == expected, "%r should be %r!" % (actual, expected)
+
+    def test_custom_formatting(self):
+        class HasHTMLOnly(object):
+            def __html__(self):
+                return Markup('<foo>')
+
+        class HasHTMLAndFormat(object):
+            def __html__(self):
+                return Markup('<foo>')
+            def __html_format__(self, spec):
+                return Markup('<FORMAT>')
+
+        assert Markup('{0}').format(HasHTMLOnly()) == Markup('<foo>')
+        assert Markup('{0}').format(HasHTMLAndFormat()) == Markup('<FORMAT>')
+
+    def test_complex_custom_formatting(self):
+        class User(object):
+            def __init__(self, id, username):
+                self.id = id
+                self.username = username
+            def __html_format__(self, format_spec):
+                if format_spec == 'link':
+                    return Markup('<a href="/user/{0}">{1}</a>').format(
+                        self.id,
+                        self.__html__(),
+                    )
+                elif format_spec:
+                    raise ValueError('Invalid format spec')
+                return self.__html__()
+            def __html__(self):
+                return Markup('<span 
class=user>{0}</span>').format(self.username)
+
+        user = User(1, 'foo')
+        assert Markup('<p>User: {0:link}').format(user) == \
+            Markup('<p>User: <a href="/user/1"><span 
class=user>foo</span></a>')
+
     def test_all_set(self):
         import markupsafe as markup
         for item in markup.__all__:
@@ -50,13 +123,30 @@
         assert escape(None) == Markup(None)
         assert escape_silent('<foo>') == Markup(u'&lt;foo&gt;')
 
+    def test_splitting(self):
+        self.assertEqual(Markup('a b').split(), [
+            Markup('a'),
+            Markup('b')
+        ])
+        self.assertEqual(Markup('a b').rsplit(), [
+            Markup('a'),
+            Markup('b')
+        ])
+        self.assertEqual(Markup('a\nb').splitlines(), [
+            Markup('a'),
+            Markup('b')
+        ])
+
+    def test_mul(self):
+        self.assertEqual(Markup('a') * 3, Markup('aaa'))
+
 
 class MarkupLeakTestCase(unittest.TestCase):
 
     def test_markup_leaks(self):
         counts = set()
-        for count in xrange(20):
-            for item in xrange(1000):
+        for count in range(20):
+            for item in range(1000):
                 escape("foo")
                 escape("<foo>")
                 escape(u"foo")
@@ -78,3 +168,5 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='suite')
+
+# vim:sts=4:sw=4:et:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MarkupSafe-0.15/setup.py new/MarkupSafe-0.21/setup.py
--- old/MarkupSafe-0.15/setup.py        2011-07-20 10:57:59.000000000 +0200
+++ new/MarkupSafe-0.21/setup.py        2014-04-17 11:50:25.000000000 +0200
@@ -1,9 +1,9 @@
 import os
 import sys
-from setuptools import setup, Extension, Feature
+from setuptools import setup, Extension
 from distutils.command.build_ext import build_ext
 from distutils.errors import CCompilerError, DistutilsExecError, \
-    DistutilsPlatformError
+     DistutilsPlatformError
 
 
 # fail safe compilation shamelessly stolen from the simplejson
@@ -13,24 +13,20 @@
 is_pypy = hasattr(sys, 'pypy_version_info')
 
 
-speedups = Feature(
-    'optional C speed-enhancement module',
-    standard=True,
-    ext_modules = [
-        Extension('markupsafe._speedups', ['markupsafe/_speedups.c']),
-    ],
-)
+# Remove old arguments that were once supported.  Thanks setuptools
+# 3.0 for just randomly removing functionality.
+for arg in '--with-speedups', '--without-speedups':
+    try:
+        sys.argv.remove(arg)
+    except ValueError:
+        pass
+
 
 ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
 if sys.platform == 'win32' and sys.version_info > (2, 6):
-   # 2.6's distutils.msvc9compiler can raise an IOError when failing to
-   # find the compiler
-   ext_errors += (IOError,)
-
-
-extra = {}
-if sys.version_info >= (3, 0):
-    extra['use_2to3'] = True
+    # 2.6's distutils.msvc9compiler can raise an IOError when failing to
+    # find the compiler
+    ext_errors += (IOError,)
 
 
 class BuildFailed(Exception):
@@ -66,13 +62,12 @@
 
 
 def run_setup(with_binary):
-    features = {}
-    if with_binary:
-        features['speedups'] = speedups
+    ext = Extension('markupsafe._speedups', ['markupsafe/_speedups.c'])
+    ext_modules = [ext] if with_binary else []
     setup(
         name='MarkupSafe',
-        version='0.15',
-        url='http://dev.pocoo.org/',
+        version='0.21',
+        url='http://github.com/mitsuhiko/markupsafe',
         license='BSD',
         author='Armin Ronacher',
         author_email='[email protected]',
@@ -95,8 +90,7 @@
         test_suite='markupsafe.tests.suite',
         include_package_data=True,
         cmdclass={'build_ext': ve_build_ext},
-        features=features,
-        **extra
+        ext_modules=ext_modules,
     )
 
 

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

Reply via email to