flatatt modifies passed in dict, possibly changing the result of subsequent calls
Reported by: |
Tim Heap |
Owned by: |
Claude Paroz <claude@…> |
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
|
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)
Owner: |
changed from nobody to parasgithub
|
Status: |
new →
assigned
|
Owner: |
parasgithub deleted
|
Status: |
assigned →
new
|
Has patch: |
set
|
Triage Stage: |
Unreviewed →
Accepted
|
Owner: |
set to Claude Paroz <claude@…>
|
Resolution: |
→ fixed
|
Status: |
new →
closed
|
A pull request has been created on Github: https://github.com/django/django/pull/3590