Merge lp:~rvb/maas/getlist-1.3-compat into lp:maas/1.2

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1305
Proposed branch: lp:~rvb/maas/getlist-1.3-compat
Merge into: lp:maas/1.2
Diff against target: 24 lines (+1/-2)
2 files modified
src/maasserver/api.py (+1/-1)
src/maasserver/tests/test_preseed.py (+0/-1)
To merge this branch: bzr merge lp:~rvb/maas/getlist-1.3-compat
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+134891@code.launchpad.net

Commit message

Fix call to request.data.getlist to make it Django 1.3-compatible.

Description of the change

This fixes a compatibility with Django 1.3 (found while running the test suite of of the 1.2 branch on a precise box):
The 1.3 version of the method 'getlist' does not support the 'default' parameter.

Turns out we already implemented a utility method to work around that limitation ('get_optional_list').

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/api.py'
--- src/maasserver/api.py 2012-11-08 09:54:37 +0000
+++ src/maasserver/api.py 2012-11-19 12:38:56 +0000
@@ -362,7 +362,7 @@
362 """362 """
363 getlist = getattr(data, 'getlist', None)363 getlist = getattr(data, 'getlist', None)
364 if getlist is not None:364 if getlist is not None:
365 return getlist(key, default)365 return get_optional_list(data, key, default)
366 return data.get(key, default)366 return data.get(key, default)
367367
368368
369369
=== modified file 'src/maasserver/tests/test_preseed.py'
--- src/maasserver/tests/test_preseed.py 2012-11-15 12:05:06 +0000
+++ src/maasserver/tests/test_preseed.py 2012-11-19 12:38:56 +0000
@@ -21,7 +21,6 @@
21 NODE_STATUS,21 NODE_STATUS,
22 PRESEED_TYPE,22 PRESEED_TYPE,
23 )23 )
24from maasserver.models import BootImage
25from maasserver.preseed import (24from maasserver.preseed import (
26 compose_enlistment_preseed_url,25 compose_enlistment_preseed_url,
27 compose_preseed_url,26 compose_preseed_url,

Subscribers

People subscribed via source and target branches

to status/vote changes: