Opened 15 years ago
Closed 14 years ago
#12369 closed (fixed)
cStringIO portability
Reported by: | Jeff Bauer | Owned by: | niall |
---|---|---|---|
Component: | Documentation | Version: | 1.1 |
Severity: | Keywords: | cStringIO portability | |
Cc: | 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
In reference to: http://docs.djangoproject.com/en/dev/howto/outputting-pdf/
cStringIO is a great way to speed up complex reportlab pdfs. For portability in environments that don't have cStringIO, I would encourage django coders to use this idiom:
try: from cStringIO import StringIO except ImportError: from StringIO import StringIO
Attachments (1)
Change History (7)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 14 years ago
I'd simplify the explanation to just a parenthetical note that "cStringIO is not avilable in all enviroments, StringIO may be used in it's place in such circumstances".
by , 14 years ago
Attachment: | outputting-pdf.diff added |
---|
comment:4 by , 14 years ago
Updated the patch, now just has a comment above the import with a one line description explaining what's happening.
comment:5 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Added a simple patch that changes the code sample to use the try, except block and a simple explanation of why it's necessary after the code sample.