Merge lp:~jtv/maas/1.5-bug-1311433 into lp:maas/1.5

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 2258
Proposed branch: lp:~jtv/maas/1.5-bug-1311433
Merge into: lp:maas/1.5
Diff against target: 35 lines (+10/-3)
1 file modified
src/maasserver/views/combo.py (+10/-3)
To merge this branch: bzr merge lp:~jtv/maas/1.5-bug-1311433
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+216812@code.launchpad.net

Commit message

Backport trunk r2277: Work around Django failure “AttributeError: 'functools.partial' object has no attribute '__module__'”.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Straight backport. Self-approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/views/combo.py'
2--- src/maasserver/views/combo.py 2014-02-05 04:57:33 +0000
3+++ src/maasserver/views/combo.py 2014-04-23 03:41:06 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2012 Canonical Ltd. This software is licensed under the
6+# Copyright 2012-2014 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 """Combo view."""
10@@ -16,7 +16,10 @@
11 'get_combo_view',
12 ]
13
14-from functools import partial
15+from functools import (
16+ partial,
17+ update_wrapper,
18+ )
19 import os
20
21 from convoy.combo import (
22@@ -76,8 +79,12 @@
23 :rtype: callable
24 """
25 location = get_absolute_location(location)
26- return partial(
27+ # Work around bug 1311433: returning a "partial" as a view causes an
28+ # AttributeError about a missing __module__ attribute. The update_wrapper
29+ # solves this.
30+ partial_view = partial(
31 combo_view, location=location, default_redirect=default_redirect)
32+ return update_wrapper(partial_view, combo_view)
33
34
35 def combo_view(request, location, default_redirect=None, encoding='utf8'):

Subscribers

People subscribed via source and target branches

to all changes: