summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGabriel Hurley <gabehr@gmail.com>2010-10-09 10:23:48 +0000
committerGabriel Hurley <gabehr@gmail.com>2010-10-09 10:23:48 +0000
commit4241197b40c0facd38a672eaf7594a01a091edae (patch)
treebcf10e9258a162d81d978cceda6fe88709385bd1 /docs
parenta96e50b76b38edb94356bb5d346ef96067175906 (diff)
[1.2.X] Improved example to account for environments where cStringIO is not available. Thanks to rubic for the report and niall for the patch.
Backport of [14076] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14077 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-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