Opened 18 years ago
Closed 14 years ago
#6667 closed New feature (wontfix)
Email compliant word wrapping
| Reported by: | Chris Beaven | Owned by: | Chris Beaven |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | yes |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I had the case of wanting to correctly wrap text emails according to the relevant RFCs. I started by hacking django.utils.text wrap but then after some rethinking, decided to split it into a separate module (even if it is a bit of similar code).
On top of this, I refactored django.utils.text wrap method to boost it's efficiency.
Attachments (2)
Change History (9)
comment:1 by , 18 years ago
| Needs documentation: | set |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 18 years ago
Regarding the django.utils.text wrap refactor, here are the results of a timeit test:
Sentence
old: 1.43731307983
new: 0.553267002106
Paragraph
old: 4.15362501144
new: 1.33707404137
10 Paragraphs
old: 17.3589639664
new: 5.5629529953
comment:3 by , 18 years ago
Please put the text wrapping refactoring in a separate ticket. They are independent and it's quite possible we'll take one (the speedup) and not the other.
by , 18 years ago
| Attachment: | mail_wrapping.diff added |
|---|
by , 18 years ago
| Attachment: | mail_wrapping.2.diff added |
|---|
patch devoid of the text wrap optimisation
comment:5 by , 15 years ago
| Type: | → New feature |
|---|
comment:6 by , 15 years ago
| Severity: | → Normal |
|---|
comment:7 by , 14 years ago
| Easy pickings: | unset |
|---|---|
| Resolution: | → wontfix |
| Status: | assigned → closed |
| UI/UX: | unset |
Discussion with Carl: wontfixing this, this is not demanded, easily lives outside of Django, and not particularly in scope for Django's primary use cases anyways. We'd probably still be interested in the speedups though, feel free to file a new ticket, or just commit yourself ;)
Has tests, but needs docs.
In a nutshell,
EmailMessagehas a new argument:wrap_text-- which wraps the body text at 78 charsAt a lower level,
SafeMIMETextnow accepts two additional keyword arguments:wrap_text-- which wraps the text at 78 charsformat_flowed-- still theformat-flowedMIME parameter but assumes the text has already been wrapped