#3733 closed (fixed)
django.utils.text.smart_split() does not properly handle unmatched quotes
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | serg@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django.utils.text.smart_split() does not properly handle unmatched quotes.
smart_split() eats up last character of the word that begins with an unmatched quote and that quote character itself:
>> text.smart_split("one 'two three") ['one', 'tw', 'three']
Of course unmatched quote in a tag argument string most probably is an error. But result produced by smart_split() ("'two" -> "tw"
) doesn't leave chances to notice or detect this error until actual use at render time (and may be even further).
Also smart_split()'s doctest still produce syntax error (in spite of #3035).
Attachments (1)
Change History (5)
by , 18 years ago
Attachment: | text-smart-split.patch added |
---|
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 18 years ago
Thanks for this fix.
Tests should go in the tests/ directory. We don't run the docstrings in the main code, so the examples there are just examples. I've fixed this in this case -- and fixed up a small bug in one of the tests in passing. Merely pointing this out for next time.
comment:3 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 17 years ago
Cc: | added |
---|
fix for unmatched quote problem, with doctests