[PATCH] Fix archiving/unarchiving of patches on patch lists.

Jeremy Kerr jk at ozlabs.org
Tue Mar 8 18:25:57 EST 2011


Hi Guilherme,

> It was broken because MultipleBooleanField() was leaking string values
> instead of boolens as expected by MultiplePatchForm.

Thanks for finding and fixing this one - and for the good testcase too.

I've applied the patch, with some minor style changes:

> +    def testArchivingPatches(self):
> +        data = self.base_data.copy()
> +        data.update({'archived': 'True'})
> +        self._selectAllPatches(data)
> +        response = self.client.post(self.url, data)
> +        self.assertContains(
> +            response, self.properties_form_id, status_code = 200)

I prefer the format:

       self.assertContains(response, self.properties_form_id,
                           status_code = 200)

> +        for patch in [Patch.objects.get(pk = p.pk) for p in self.patches]:
> +            self.assertFalse(patch.archived)

I find the more complex iterator harder to read, I've done this instead:

    for p in self.patches:
        self.assertFalse(Patch.objects.get(pk = p.pk).archived)

Nothing critical, just letting you know for future patches :)

Cheers,


Jeremy


More information about the Patchwork mailing list