summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Hurley <gabehr@gmail.com>2010-10-09 10:21:55 +0000
committerGabriel Hurley <gabehr@gmail.com>2010-10-09 10:21:55 +0000
commit05001056a861419e2dc112a0395602e5a04f979f (patch)
tree2c154aab4bdfe1c6fafe21c79b0a09d7bc9b0161
parent6400026feb034056c0d0badcadd61804f94d8afb (diff)
Fixed #12369 -- Improved example to account for environments where cStringIO is not available. Thanks to rubic for the report and niall for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--docs/howto/outputting-pdf.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt
index 32e38aebc6..67950d03f2 100644
--- a/docs/howto/outputting-pdf.txt
+++ b/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