diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2011-01-25 21:56:04 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2011-01-25 21:56:04 +0000 |
commit | 19da64a33c454aaf978fdf3042538bf1598a8a5b (patch) | |
tree | 34be3fe3da19052f21d02fc583600c8816bf7f5c /dev-python/django | |
parent | Masking dev-util/plan9port for QA removal. (diff) | |
download | gentoo-2-19da64a33c454aaf978fdf3042538bf1598a8a5b.tar.gz gentoo-2-19da64a33c454aaf978fdf3042538bf1598a8a5b.tar.bz2 gentoo-2-19da64a33c454aaf978fdf3042538bf1598a8a5b.zip |
Fix regression in FormWizard (Django ticket #14576). Fix tests with Python 2.7 (Django ticket #14947).
(Portage version: 2.2.0_alpha19_p1/cvs/Linux x86_64)
Diffstat (limited to 'dev-python/django')
-rw-r--r-- | dev-python/django/ChangeLog | 12 | ||||
-rw-r--r-- | dev-python/django/django-1.2.4-r1.ebuild | 102 | ||||
-rw-r--r-- | dev-python/django/files/django-1.2.4-python-2.7.patch | 29 | ||||
-rw-r--r-- | dev-python/django/files/django-1.2.4-ticket-14576.patch | 64 |
4 files changed, 205 insertions, 2 deletions
diff --git a/dev-python/django/ChangeLog b/dev-python/django/ChangeLog index 8da5c06c1828..2133e8d03df8 100644 --- a/dev-python/django/ChangeLog +++ b/dev-python/django/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for dev-python/django -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/django/ChangeLog,v 1.57 2010/12/23 14:46:35 arfrever Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/django/ChangeLog,v 1.58 2011/01/25 21:56:04 arfrever Exp $ + +*django-1.2.4-r1 (25 Jan 2011) + + 25 Jan 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> + +django-1.2.4-r1.ebuild, +files/django-1.2.4-python-2.7.patch, + +files/django-1.2.4-ticket-14576.patch: + Fix regression in FormWizard (Django ticket #14576). Fix tests with Python 2.7 + (Django ticket #14947). *django-1.2.4 (23 Dec 2010) diff --git a/dev-python/django/django-1.2.4-r1.ebuild b/dev-python/django/django-1.2.4-r1.ebuild new file mode 100644 index 000000000000..23c476252b41 --- /dev/null +++ b/dev-python/django/django-1.2.4-r1.ebuild @@ -0,0 +1,102 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/django/django-1.2.4-r1.ebuild,v 1.1 2011/01/25 21:56:04 arfrever Exp $ + +EAPI="3" +PYTHON_DEPEND="2" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.*" + +inherit bash-completion distutils eutils versionator webapp + +MY_P="Django-${PV}" + +DESCRIPTION="High-level Python web framework" +HOMEPAGE="http://www.djangoproject.com/ http://pypi.python.org/pypi/Django" +SRC_URI="http://media.djangoproject.com/releases/$(get_version_component_range 1-2)/${MY_P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos" +IUSE="doc mysql postgres sqlite test" + +RDEPEND="dev-python/imaging + sqlite? ( || ( dev-lang/python:2.7[sqlite] dev-lang/python:2.6[sqlite] dev-lang/python:2.5[sqlite] dev-python/pysqlite:2 ) ) + postgres? ( dev-python/psycopg ) + mysql? ( >=dev-python/mysql-python-1.2.1_p2 )" +DEPEND="${RDEPEND} + doc? ( >=dev-python/sphinx-0.3 ) + test? ( || ( dev-lang/python:2.7[sqlite] dev-lang/python:2.6[sqlite] dev-lang/python:2.5[sqlite] dev-python/pysqlite:2 ) )" + +S="${WORKDIR}/${MY_P}" + +DOCS="docs/* AUTHORS" +WEBAPP_MANUAL_SLOT="yes" + +pkg_setup() { + python_pkg_setup + webapp_pkg_setup +} + +src_prepare() { + distutils_src_prepare + epatch "${FILESDIR}/${P}-ticket-14576.patch" + epatch "${FILESDIR}/${P}-python-2.7.patch" +} + +src_compile() { + distutils_src_compile + + if use doc; then + einfo "Generation of documentation" + pushd docs > /dev/null + emake html || die "Generation of documentation failed" + popd > /dev/null + fi +} + +src_test() { + testing() { + # Tests have non-standard assumptions about PYTHONPATH and + # don't work with usual "build-${PYTHON_ABI}/lib". + PYTHONPATH="." "$(PYTHON)" tests/runtests.py --settings=test_sqlite -v1 + } + python_execute_function testing +} + +src_install() { + distutils_src_install + + dobashcompletion extras/django_bash_completion + + if use doc; then + rm -fr docs/_build/html/_sources + dohtml -A txt -r docs/_build/html/* || die "dohtml failed" + fi + + insinto "${MY_HTDOCSDIR#${EPREFIX}}" + doins -r django/contrib/admin/media/* || die "doins failed" + + webapp_src_install +} + +pkg_preinst() { + : +} + +pkg_postinst() { + bash-completion_pkg_postinst + distutils_pkg_postinst + + einfo "Now, Django has the best of both worlds with Gentoo," + einfo "ease of deployment for production and development." + echo + elog "A copy of the admin media is available to" + elog "webapp-config for installation in a webroot," + elog "as well as the traditional location in python's" + elog "site-packages dir for easy development" + echo + ewarn "If you build Django ${PV} without USE=\"vhosts\"" + ewarn "webapp-config will automatically install the" + ewarn "admin media into the localhost webroot." +} diff --git a/dev-python/django/files/django-1.2.4-python-2.7.patch b/dev-python/django/files/django-1.2.4-python-2.7.patch new file mode 100644 index 000000000000..53923844f7e3 --- /dev/null +++ b/dev-python/django/files/django-1.2.4-python-2.7.patch @@ -0,0 +1,29 @@ +http://code.djangoproject.com/ticket/14947 +http://code.djangoproject.com/changeset/15165 + +--- tests/regressiontests/fixtures_regress/tests.py ++++ tests/regressiontests/fixtures_regress/tests.py +@@ -1,6 +1,7 @@ + # -*- coding: utf-8 -*- + # Unittests for fixtures. + import os ++import re + import sys + try: + from cStringIO import StringIO +@@ -327,9 +328,14 @@ + + # Output order isn't guaranteed, so check for parts + data = stdout.getvalue() ++ ++ # Get rid of artifacts like '000000002' to eliminate the differences ++ # between different Python versions. ++ data = re.sub('0{6,}\d', '', data) ++ + lion_json = '{"pk": 1, "model": "fixtures_regress.animal", "fields": {"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}}' + emu_json = '{"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42, "weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}}' +- platypus_json = '{"pk": %d, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.2000000000000002, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}' ++ platypus_json = '{"pk": %d, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.2, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}' + platypus_json = platypus_json % animal.pk + + self.assertEqual(len(data), len('[%s]' % ', '.join([lion_json, emu_json, platypus_json]))) diff --git a/dev-python/django/files/django-1.2.4-ticket-14576.patch b/dev-python/django/files/django-1.2.4-ticket-14576.patch new file mode 100644 index 000000000000..8308e5405fe2 --- /dev/null +++ b/dev-python/django/files/django-1.2.4-ticket-14576.patch @@ -0,0 +1,64 @@ +http://code.djangoproject.com/ticket/14576 +http://code.djangoproject.com/changeset/15044 + +--- django/contrib/formtools/tests.py ++++ django/contrib/formtools/tests.py +@@ -116,7 +116,7 @@ + hash1 = utils.security_hash(None, f1) + hash2 = utils.security_hash(None, f2) + self.assertEqual(hash1, hash2) +- ++ + def test_empty_permitted(self): + """ + Regression test for #10643: the security hash should allow forms with +@@ -214,3 +214,26 @@ + wizard(DummyRequest(POST=data)) + self.assertTrue(reached[0]) + ++ def test_14576(self): ++ """ ++ Regression test for ticket #14576. ++ ++ The form of the last step is not passed to the done method. ++ """ ++ reached = [False] ++ that = self ++ ++ class Wizard(WizardClass): ++ def done(self, request, form_list): ++ reached[0] = True ++ that.assertTrue(len(form_list) == 2) ++ ++ wizard = Wizard([WizardPageOneForm, ++ WizardPageTwoForm]) ++ ++ data = {"0-field": "test", ++ "1-field": "test2", ++ "hash_0": "2fdbefd4c0cad51509478fbacddf8b13", ++ "wizard_step": "1"} ++ wizard(DummyRequest(POST=data)) ++ self.assertTrue(reached[0]) +--- django/contrib/formtools/wizard.py ++++ django/contrib/formtools/wizard.py +@@ -94,9 +94,9 @@ + # Since the hashes only take into account values, and not other + # other validation the form might do, we must re-do validation + # now for security reasons. +- current_form_list = [self.get_form(i, request.POST) for i in range(current_step)] ++ previous_form_list = [self.get_form(i, request.POST) for i in range(current_step)] + +- for i, f in enumerate(current_form_list): ++ for i, f in enumerate(previous_form_list): + if request.POST.get("hash_%d" % i, '') != self.security_hash(request, f): + return self.render_hash_failure(request, i) + +@@ -111,7 +111,7 @@ + + + if next_step == self.num_steps(): +- return self.done(request, current_form_list) ++ return self.done(request, previous_form_list + [form]) + else: + form = self.get_form(next_step) + self.step = current_step = next_step |