← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Raphaël Badin has proposed merging lp:~rvb/maas/getlist-1.3-compat into lp:maas/1.2.

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

Requested reviews:
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #1080673 in MAAS 1.2: "src/maasserver/api.py calls request.get with a 'default' parameter.  That parameter is not supported by Django 1.3."
  https://bugs.launchpad.net/maas/1.2/+bug/1080673

For more details, see:
https://code.launchpad.net/~rvb/maas/getlist-1.3-compat/+merge/134891

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').
-- 
https://code.launchpad.net/~rvb/maas/getlist-1.3-compat/+merge/134891
Your team MAAS Maintainers is requested to review the proposed merge of lp:~rvb/maas/getlist-1.3-compat into lp:maas/1.2.
=== 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 @@
     """
     getlist = getattr(data, 'getlist', None)
     if getlist is not None:
-        return getlist(key, default)
+        return get_optional_list(data, key, default)
     return data.get(key, default)
 
 

=== 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 @@
     NODE_STATUS,
     PRESEED_TYPE,
     )
-from maasserver.models import BootImage
 from maasserver.preseed import (
     compose_enlistment_preseed_url,
     compose_preseed_url,