Hello community, here is the log from the commit of package python-MarkupSafe for openSUSE:Factory checked in at 2013-07-02 12:28:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-MarkupSafe (Old) and /work/SRC/openSUSE:Factory/.python-MarkupSafe.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-MarkupSafe" Changes: -------- --- /work/SRC/openSUSE:Factory/python-MarkupSafe/python-MarkupSafe.changes 2012-05-25 16:19:02.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-MarkupSafe.new/python-MarkupSafe.changes 2013-07-02 14:28:16.000000000 +0200 @@ -1,0 +2,7 @@ +Tue Jun 25 11:56:41 UTC 2013 - dmueller@suse.com + +- update to 0.18: + + Fixed interpolation on tuples + + Varios Python 3.x fixes + +------------------------------------------------------------------- Old: ---- MarkupSafe-0.15.tar.gz New: ---- MarkupSafe-0.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-MarkupSafe.spec ++++++ --- /var/tmp/diff_new_pack.v127m5/_old 2013-07-02 14:28:17.000000000 +0200 +++ /var/tmp/diff_new_pack.v127m5/_new 2013-07-02 14:28:17.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-MarkupSafe -Version: 0.15 +Version: 0.18 Release: 0 Url: http://dev.pocoo.org/ Summary: Implements a XML/HTML/XHTML Markup safe string for Python ++++++ MarkupSafe-0.15.tar.gz -> MarkupSafe-0.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-0.15/MarkupSafe.egg-info/PKG-INFO new/MarkupSafe-0.18/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.18/MarkupSafe.egg-info/PKG-INFO 2013-05-22 03:15:40.000000000 +0200 @@ -1,8 +1,8 @@ Metadata-Version: 1.0 Name: MarkupSafe -Version: 0.15 +Version: 0.18 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: armin.ronacher@active-4.com 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-0.15/MarkupSafe.egg-info/SOURCES.txt new/MarkupSafe-0.18/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.18/MarkupSafe.egg-info/SOURCES.txt 2013-05-22 03:15:40.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.18/PKG-INFO --- old/MarkupSafe-0.15/PKG-INFO 2011-07-20 10:58:12.000000000 +0200 +++ new/MarkupSafe-0.18/PKG-INFO 2013-05-22 03:15:40.000000000 +0200 @@ -1,8 +1,8 @@ Metadata-Version: 1.0 Name: MarkupSafe -Version: 0.15 +Version: 0.18 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: armin.ronacher@active-4.com 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-0.15/README.rst new/MarkupSafe-0.18/README.rst --- old/MarkupSafe-0.15/README.rst 2010-09-07 17:43:12.000000000 +0200 +++ new/MarkupSafe-0.18/README.rst 2013-05-20 20:25:19.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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-0.15/markupsafe/__init__.py new/MarkupSafe-0.18/markupsafe/__init__.py --- old/MarkupSafe-0.15/markupsafe/__init__.py 2010-09-07 17:45:38.000000000 +0200 +++ new/MarkupSafe-0.18/markupsafe/__init__.py 2013-05-22 03:13:09.000000000 +0200 @@ -9,7 +9,8 @@ :license: BSD, see LICENSE for more details. """ import re -from itertools import imap +from markupsafe._compat import text_type, string_types, int_types, \
unichr, PY2
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent'] @@ -19,7 +20,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 +69,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 » <em>About</em>").unescape() @@ -139,10 +140,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: @@ -164,10 +165,10 @@ return rv def make_wrapper(name): - orig = getattr(unicode, 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, kwargs.iteritems(), None) return self.__class__(orig(self, *args, **kwargs)) func.__name__ = orig.__name__ func.__doc__ = orig.__doc__ @@ -180,29 +181,29 @@ locals()[method] = make_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'): + if hasattr(text_type, 'format'): format = make_wrapper('format') # not in python 3 - if hasattr(unicode, '__getslice__'): + if hasattr(text_type, '__getslice__'): __getslice__ = make_wrapper('__getslice__') del method, make_wrapper -def _escape_argspec(obj, iterable): +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 +211,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 +228,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.18/markupsafe/_compat.py --- old/MarkupSafe-0.15/markupsafe/_compat.py 1970-01-01 01:00:00.000000000 +0100 +++ new/MarkupSafe-0.18/markupsafe/_compat.py 2013-05-22 03:13:09.000000000 +0200 @@ -0,0 +1,24 @@ +# -*- 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,) +else: + text_type = unicode + string_types = (str, unicode) + unichr = unichr + int_types = (int, long) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-0.15/markupsafe/_native.py new/MarkupSafe-0.18/markupsafe/_native.py --- old/MarkupSafe-0.15/markupsafe/_native.py 2010-09-07 17:43:12.000000000 +0200 +++ new/MarkupSafe-0.18/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('&', '&') .replace('>', '>') .replace('<', '<') @@ -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.18/markupsafe/tests.py --- old/MarkupSafe-0.15/markupsafe/tests.py 2010-09-07 17:43:12.000000000 +0200 +++ new/MarkupSafe-0.18/markupsafe/tests.py 2013-05-22 03:13:29.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><bad user></em>' @@ -18,6 +21,10 @@ 'username': '<bad user>' } == '<em><bad user></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,16 +32,34 @@ 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><foo>:<bar></em>')) + + def test_dict_interpol(self): + self.assertEqual(Markup('<em>%(foo)s</em>') % { + 'foo': '<foo>', + }, Markup(u'<em><foo></em>')) + self.assertEqual(Markup('<em>%(foo)s:%(bar)s</em>') % { + 'foo': '<foo>', + 'bar': '<bar>', + }, Markup(u'<em><foo>:<bar></em>')) + + def test_escaping(self): # escaping and unescaping assert escape('"<>&'') == '"<>&'' assert Markup("<em>Foo & Bar</em>").striptags() == "Foo & Bar" @@ -50,13 +75,30 @@ assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>') + 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 +120,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.18/setup.py --- old/MarkupSafe-0.15/setup.py 2011-07-20 10:57:59.000000000 +0200 +++ new/MarkupSafe-0.18/setup.py 2013-05-22 03:15:33.000000000 +0200 @@ -28,11 +28,6 @@ ext_errors += (IOError,) -extra = {} -if sys.version_info >= (3, 0): - extra['use_2to3'] = True - - class BuildFailed(Exception): pass @@ -71,8 +66,8 @@ features['speedups'] = speedups setup( name='MarkupSafe', - version='0.15', - url='http://dev.pocoo.org/', + version='0.18', + url='http://github.com/mitsuhiko/markupsafe', license='BSD', author='Armin Ronacher', author_email='armin.ronacher@active-4.com', @@ -96,7 +91,6 @@ include_package_data=True, cmdclass={'build_ext': ve_build_ext}, features=features, - **extra ) -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org