Hello community, here is the log from the commit of package python-bottle for openSUSE:Factory checked in at 2012-08-23 16:05:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-bottle (Old) and /work/SRC/openSUSE:Factory/.python-bottle.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-bottle", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-bottle/python-bottle.changes 2012-03-16 13:21:35.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-bottle.new/python-bottle.changes 2012-08-23 16:05:46.000000000 +0200 @@ -1,0 +2,7 @@ +Wed Aug 15 03:24:14 UTC 2012 - highwaystar.ru@gmail.com + +- updated to 0.10.11 +- python3 package added +- spec improved (files section) + +------------------------------------------------------------------- New Changes file: --- /dev/null 2012-08-23 02:41:28.555381587 +0200 +++ /work/SRC/openSUSE:Factory/.python-bottle.new/python3-bottle.changes 2012-08-23 16:05:46.000000000 +0200 @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Wed Aug 15 03:24:00 UTC 2012 - highwaystar.ru@gmail.com + +- python3 package added + Old: ---- bottle-0.10.9.tar.gz New: ---- bottle-0.10.11.tar.gz python3-bottle.changes python3-bottle.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-bottle.spec ++++++ --- /var/tmp/diff_new_pack.GskKsR/_old 2012-08-23 16:05:47.000000000 +0200 +++ /var/tmp/diff_new_pack.GskKsR/_new 2012-08-23 16:05:47.000000000 +0200 @@ -16,7 +16,7 @@ # Name: python-bottle -Version: 0.10.9 +Version: 0.10.11 Release: 0 Url: http://bottlepy.org/ Summary: Fast and simple WSGI-framework for small web-applications @@ -49,6 +49,7 @@ %defattr(-,root,root,-) %doc LICENSE.txt README.rst bottle-docs.pdf %{_bindir}/bottle.py -%{python_sitelib}/* +%{python_sitelib}/bottle.py* +%{python_sitelib}/bottle-%{version}-py%{py_ver}.egg-info %changelog ++++++ python3-bottle.spec ++++++ # # spec file for package python-bottle # # Copyright (c) 2011 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 # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # 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: python3-bottle Version: 0.10.11 Release: 0 Url: http://bottlepy.org/ Summary: Fast and simple WSGI-framework for small web-applications License: MIT Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/b/bottle/bottle-%{version}.tar.gz Source1: bottle-docs.pdf BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python3-devel BuildRequires: python3-2to3 %if 0%{?suse_version} && 0%{?suse_version} <= 1140 %{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)} %endif Requires: python(abi) = %{py3_ver} %if 0%{?suse_version} && 0%{?suse_version} > 1140 BuildRequires: python3-base %endif %if %{?suse_version: %{suse_version} > 1110} %{!?suse_version:1} BuildArchitectures: noarch %endif %description Bottle is a fast and simple micro-framework for small web-applications. It offers request dispatching (Routes) with url parameter support, Templates, a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and template engines. All in a single file and with no dependencies other than the Python Standard Library. %prep %setup -q -n bottle-%{version} cp %{SOURCE1} . %build python3 setup.py build 2to3 -w -n bottle.py %install python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} mv %{buildroot}%{_bindir}/bottle.py %{buildroot}%{_bindir}/bottle-%{py3_ver}.py if [ -d "%{buildroot}%{python3_sitelib}/__pycache__" ]; then rm -r %{buildroot}%{python3_sitelib}/__pycache__ fi %files %defattr(-,root,root,-) %doc LICENSE.txt README.rst bottle-docs.pdf %{_bindir}/bottle-%{py3_ver}.py %{python3_sitelib}/bottle.py* %{python3_sitelib}/bottle-%{version}-py%{py3_ver}.egg-info %if 0%{?suse_version} <= 1140 %dir %{_prefix}/lib/python%{py3_ver} %dir %{python3_sitelib} %endif %changelog ++++++ bottle-0.10.9.tar.gz -> bottle-0.10.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bottle-0.10.9/PKG-INFO new/bottle-0.10.11/PKG-INFO --- old/bottle-0.10.9/PKG-INFO 2012-02-11 19:46:11.000000000 +0100 +++ new/bottle-0.10.11/PKG-INFO 2012-06-26 12:35:31.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: bottle -Version: 0.10.9 +Version: 0.10.11 Summary: Fast and simple WSGI-framework for small web-applications. Home-page: http://bottlepy.org/ Author: Marcel Hellkamp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bottle-0.10.9/bottle.py new/bottle-0.10.11/bottle.py --- old/bottle-0.10.9/bottle.py 2012-02-11 19:45:14.000000000 +0100 +++ new/bottle-0.10.11/bottle.py 2012-06-26 12:34:06.000000000 +0200 @@ -16,7 +16,7 @@ from __future__ import with_statement __author__ = 'Marcel Hellkamp' -__version__ = '0.10.9' +__version__ = '0.10.11' __license__ = 'MIT' # The gevent server adapter needs to patch some modules before they are imported @@ -70,10 +70,6 @@ except ImportError: # pragma: no cover from UserDict import DictMixin -try: from urlparse import parse_qsl -except ImportError: # pragma: no cover - from cgi import parse_qsl - try: import cPickle as pickle except ImportError: # pragma: no cover import pickle @@ -88,7 +84,8 @@ raise ImportError("JSON support requires Python 2.6 or simplejson.") json_lds = json_dumps -py3k = sys.version_info >= (3,0,0) +py = sys.version_info +py3k = py >= (3,0,0) NCTextIOWrapper = None if sys.version_info < (2,6,0): @@ -97,6 +94,7 @@ if py3k: # pragma: no cover json_loads = lambda s: json_lds(touni(s)) + urlunquote = functools.partial(urlunquote, encoding='latin1') # See Request.POST from io import BytesIO def touni(x, enc='utf8', err='strict'): @@ -128,6 +126,15 @@ functools.update_wrapper(wrapper, wrapped, *a, **ka) except AttributeError: pass +# 3.2 fixes cgi.FieldStorage to accept bytes (which makes a lot of sense). +# but defaults to utf-8 (which is not always true) +# 3.1 needs a workaround. +NCTextIOWrapper = None +if (3,0,0) < py < (3,2,0): + from io import TextIOWrapper + class NCTextIOWrapper(TextIOWrapper): + def close(self): pass # Keep wrapped buffer open. + # Backward compatibility def depr(message): warnings.warn(message, DeprecationWarning, stacklevel=3) @@ -920,8 +927,8 @@ values are sometimes called "URL arguments" or "GET parameters", but not to be confused with "URL wildcards" as they are provided by the :class:`Router`. ''' - pairs = parse_qsl(self.query_string, keep_blank_values=True) get = self.environ['bottle.get'] = FormsDict() + pairs = _parse_qsl(self.environ.get('QUERY_STRING', '')) for key, value in pairs[:self.MAX_PARAMS]: get[key] = value return get @@ -1017,14 +1024,25 @@ instances of :class:`cgi.FieldStorage` (file uploads). """ post = FormsDict() + # We default to application/x-www-form-urlencoded for everything that + # is not multipart and take the fast path (also: 3.1 workaround) + if not self.content_type.startswith('multipart/'): + maxlen = max(0, min(self.content_length, self.MEMFILE_MAX)) + pairs = _parse_qsl(tonat(self.body.read(maxlen), 'latin1')) + for key, value in pairs[:self.MAX_PARAMS]: + post[key] = value + return post + safe_env = {'QUERY_STRING':''} # Build a safe environment for cgi for key in ('REQUEST_METHOD', 'CONTENT_TYPE', 'CONTENT_LENGTH'): if key in self.environ: safe_env[key] = self.environ[key] + args = dict(fp=self.body, environ=safe_env, keep_blank_values=True) + if py >= (3,2,0): + args['encoding'] = 'ISO-8859-1' if NCTextIOWrapper: - fb = NCTextIOWrapper(self.body, encoding='ISO-8859-1', newline='\n') - else: - fb = self.body - data = cgi.FieldStorage(fp=fb, environ=safe_env, keep_blank_values=True) + args['fp'] = NCTextIOWrapper(args['fp'], encoding='ISO-8859-1', + newline='\n') + data = cgi.FieldStorage(**args) for item in (data.list or [])[:self.MAX_PARAMS]: post[item.name] = item if item.filename else item.value return post @@ -1099,6 +1117,11 @@ return int(self.environ.get('CONTENT_LENGTH') or -1) @property + def content_type(self): + ''' The Content-Type header as a lowercase-string (default: empty). ''' + return self.environ.get('CONTENT_TYPE', '').lower() + + @property def is_xhr(self): ''' True if the request was triggered by a XMLHttpRequest. This only works with JavaScript libraries that support the `X-Requested-With` @@ -1895,6 +1918,18 @@ return None +def _parse_qsl(qs): + r = [] + for pair in qs.replace(';','&').split('&'): + if not pair: continue + nv = pair.split('=', 1) + if len(nv) != 2: nv.append('') + key = urlunquote(nv[0].replace('+', ' ')) + value = urlunquote(nv[1].replace('+', ' ')) + r.append((key, value)) + return r + + def _lscmp(a, b): ''' Compares two strings in a cryptographically save way: Runtime is not affected by length of common prefix. ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bottle-0.10.9/test/test_environ.py new/bottle-0.10.11/test/test_environ.py --- old/bottle-0.10.9/test/test_environ.py 2012-02-11 19:43:46.000000000 +0100 +++ new/bottle-0.10.11/test/test_environ.py 2012-06-26 12:24:42.000000000 +0200 @@ -137,17 +137,20 @@ def test_get(self): """ Environ: GET data """ - request = BaseRequest({'QUERY_STRING':'a=a&a=1&b=b&c=c'}) + qs = tonat(tob('a=a&a=1&b=b&c=c&cn=%e7%93%b6'), 'latin1') + request = BaseRequest({'QUERY_STRING':qs}) self.assertTrue('a' in request.query) self.assertTrue('b' in request.query) self.assertEqual(['a','1'], request.query.getall('a')) self.assertEqual(['b'], request.query.getall('b')) self.assertEqual('1', request.query['a']) self.assertEqual('b', request.query['b']) + self.assertEqual(tonat(tob('瓶'), 'latin1'), request.query['cn']) + self.assertEqual(touni('瓶'), request.query.cn) def test_post(self): """ Environ: POST data """ - sq = u'a=a&a=1&b=b&c=&d'.encode('utf8') + sq = tob('a=a&a=1&b=b&c=&d&cn=%e7%93%b6') e = {} wsgiref.util.setup_testing_defaults(e) e['wsgi.input'].write(sq) @@ -163,6 +166,8 @@ self.assertEqual('b', request.POST['b']) self.assertEqual('', request.POST['c']) self.assertEqual('', request.POST['d']) + self.assertEqual(tonat(tob('瓶'), 'latin1'), request.POST['cn']) + self.assertEqual(touni('瓶'), request.POST.cn) def test_bodypost(self): sq = u'foobar'.encode('utf8') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bottle-0.10.9/test/test_formsdict.py new/bottle-0.10.11/test/test_formsdict.py --- old/bottle-0.10.9/test/test_formsdict.py 2012-02-11 19:43:46.000000000 +0100 +++ new/bottle-0.10.11/test/test_formsdict.py 2012-06-26 12:24:31.000000000 +0200 @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# '瓶' means "Bottle" import unittest from bottle import FormsDict, touni, tob @@ -6,10 +7,9 @@ class TestFormsDict(unittest.TestCase): def test_attr_access(self): """ FomsDict.attribute returs string values as unicode. """ - data = u'äöü'.encode('utf8') - d = FormsDict(py2=data, py3=data.decode('latin1')) - self.assertEqual(u'äöü', d.py2) - self.assertEqual(u'äöü', d.py3) + d = FormsDict(py2=tob('瓶'), py3=tob('瓶').decode('latin1')) + self.assertEqual(touni('瓶'), d.py2) + self.assertEqual(touni('瓶'), d.py3) def test_attr_missing(self): """ FomsDict.attribute returs u'' on missing keys. """ @@ -18,12 +18,10 @@ def test_attr_unicode_error(self): """ FomsDict.attribute returs u'' on UnicodeError. """ - d = FormsDict(latin=u'äöü'.encode('latin1')) - self.assertEqual(u'', d.latin) + d = FormsDict(latin=touni('öäüß').encode('latin1')) + self.assertEqual(touni(''), d.latin) d.input_encoding = 'latin1' - self.assertEqual(u'äöü', d.latin) - - + self.assertEqual(touni('öäüß'), d.latin) if __name__ == '__main__': #pragma: no cover -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org