Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #12369 -- Improved example to account for environments where cS…

…tringIO is not available. Thanks to rubic for the report and niall for the patch.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 6400026 commit 05001056a861419e2dc112a0395602e5a04f979f Gabriel Hurley committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 docs/howto/outputting-pdf.txt
6 docs/howto/outputting-pdf.txt
@@ -101,7 +101,11 @@ cStringIO_ library as a temporary holding place for your PDF file. The cStringIO
library provides a file-like object interface that is particularly efficient.
Here's the above "Hello World" example rewritten to use ``cStringIO``::
- from cStringIO import StringIO
+ # Fall back to StringIO in environments where cStringIO is not available
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
from reportlab.pdfgen import canvas
from django.http import HttpResponse

0 comments on commit 0500105

Please sign in to comment.
Something went wrong with that request. Please try again.