[Python-modules-commits] r28625 - in packages/python-django/trunk/debian (3 files)
lfaraone at users.alioth.debian.org
lfaraone at users.alioth.debian.org
Wed Apr 23 04:39:32 UTC 2014
Date: Wednesday, April 23, 2014 @ 04:38:54
Author: lfaraone
Revision: 28625
releasing package python-django version 1.6.3-2
Added:
packages/python-django/trunk/debian/patches/partial_functions_reverse.patch
Modified:
packages/python-django/trunk/debian/changelog
packages/python-django/trunk/debian/patches/series
Modified: packages/python-django/trunk/debian/changelog
===================================================================
--- packages/python-django/trunk/debian/changelog 2014-04-23 03:42:56 UTC (rev 28624)
+++ packages/python-django/trunk/debian/changelog 2014-04-23 04:38:54 UTC (rev 28625)
@@ -1,3 +1,10 @@
+python-django (1.6.3-2) unstable; urgency=high
+
+ * Fix regression of reverse() and partial views. (LP: #1311433)
+ Thanks Preston Timmons.
+
+ -- Luke Faraone <lfaraone at debian.org> Tue, 22 Apr 2014 20:44:18 -0700
+
python-django (1.6.3-1) unstable; urgency=high
* New upstream security release.
Added: packages/python-django/trunk/debian/patches/partial_functions_reverse.patch
===================================================================
--- packages/python-django/trunk/debian/patches/partial_functions_reverse.patch (rev 0)
+++ packages/python-django/trunk/debian/patches/partial_functions_reverse.patch 2014-04-23 04:38:54 UTC (rev 28625)
@@ -0,0 +1,76 @@
+From: Preston Timmons <prestontimmons at gfa.org>
+Origin: https://github.com/django/django/pull/2601/
+Last-Updated: 2014-06-22
+Subject: Fixed #22486: Reverse raises AttributeError on partial functions.
+
+Create the lookup_str from the original function whenever a partial
+is provided as an argument to a url pattern.
+---
+ django/core/urlresolvers.py | 4 ++++
+ tests/urlpatterns_reverse/urls.py | 6 +++++-
+ tests/urlpatterns_reverse/views.py | 10 ++++++++++
+ 3 files changed, 19 insertions(+), 1 deletion(-)
+
+--- a/django/core/urlresolvers.py
++++ b/django/core/urlresolvers.py
+@@ -11,6 +11,8 @@
+ import re
+ from threading import local
+
++import functools
++
+ from django.http import Http404
+ from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
+ from django.utils.datastructures import MultiValueDict
+@@ -268,6 +270,9 @@
+ self._callback_strs.add(pattern._callback_str)
+ elif hasattr(pattern, '_callback'):
+ callback = pattern._callback
++ if isinstance(callback, functools.partial):
++ callback = callback.func
++
+ if not hasattr(callback, '__name__'):
+ lookup_str = callback.__module__ + "." + callback.__class__.__name__
+ else:
+--- a/tests/urlpatterns_reverse/urls.py
++++ b/tests/urlpatterns_reverse/urls.py
+@@ -2,7 +2,7 @@
+
+ from django.conf.urls import patterns, url, include
+
+-from .views import empty_view, absolute_kwargs_view
++from .views import empty_view, empty_view_partial, empty_view_wrapped, absolute_kwargs_view
+
+
+ other_patterns = patterns('',
+@@ -53,6 +53,10 @@
+ include('urlpatterns_reverse.included_urls')),
+ url('', include('urlpatterns_reverse.extra_urls')),
+
++ # Partials should be fine.
++ url(r'^partial/', empty_view_partial, name="partial"),
++ url(r'^partial_wrapped/', empty_view_wrapped, name="partial_wrapped"),
++
+ # This is non-reversible, but we shouldn't blow up when parsing it.
+ url(r'^(?:foo|bar)(\w+)/$', empty_view, name="disjunction"),
+
+--- a/tests/urlpatterns_reverse/views.py
++++ b/tests/urlpatterns_reverse/views.py
+@@ -1,3 +1,5 @@
++from functools import partial, update_wrapper
++
+ from django.http import HttpResponse
+ from django.views.generic import RedirectView
+ from django.core.urlresolvers import reverse_lazy
+@@ -45,3 +47,11 @@
+
+ def bad_view(request, *args, **kwargs):
+ raise ValueError("I don't think I'm getting good value for this view")
++
++
++empty_view_partial = partial(empty_view, template_name="template.html")
++
++
++empty_view_wrapped = update_wrapper(
++ partial(empty_view, template_name="template.html"), empty_view,
++)
Modified: packages/python-django/trunk/debian/patches/series
===================================================================
--- packages/python-django/trunk/debian/patches/series 2014-04-23 03:42:56 UTC (rev 28624)
+++ packages/python-django/trunk/debian/patches/series 2014-04-23 04:38:54 UTC (rev 28625)
@@ -1,3 +1,4 @@
02_disable-sources-in-sphinxdoc.diff
03_manpage.diff
06_use_debian_geoip_database_as_default.diff
+partial_functions_reverse.patch
More information about the Python-modules-commits
mailing list