django/django — pull request #3590 by timheap (2014-11-21 01:43:01+00:00)
Title: Fixed #23883 -- Stop flatatt modifying its argument

The `django.forms.utils.flatatt` function modifies the dict passed in, deleting any boolean attributes it encounters. Calling the function twice using the same dict that contains boolean attributes will thus result in different output, as the boolean attributes have been deleted:

```python
>>> attrs = {'hello': 'world', 'data-true': True, 'data-false': False}
>>> flatatt(attrs)
' hello="world" data-true'
>>> flatatt(attrs)
' hello="world"'
```

The function should not modify the dict passed in like it does, leaving it unchanged. Fixing this will make the function behave as expected when called with the same dict twice.

https://code.djangoproject.com/ticket/23883#ticket