Opened 11 years ago
Closed 11 years ago
#23883 closed Bug (fixed)
flatatt modifies passed in dict, possibly changing the result of subsequent calls
| Reported by: | Tim Heap | Owned by: | |
|---|---|---|---|
| Component: | Uncategorized | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The updated 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:
>>> 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.
Change History (5)
comment:1 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 11 years ago
comment:3 by , 11 years ago
| Owner: | removed |
|---|---|
| Status: | assigned → new |
comment:4 by , 11 years ago
| Has patch: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:5 by , 11 years ago
| Owner: | set to |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
A pull request has been created on Github: https://github.com/django/django/pull/3590