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
This commit is contained in:
parent
6400026feb
commit
05001056a8
|
@ -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.
|
library provides a file-like object interface that is particularly efficient.
|
||||||
Here's the above "Hello World" example rewritten to use ``cStringIO``::
|
Here's the above "Hello World" example rewritten to use ``cStringIO``::
|
||||||
|
|
||||||
|
# Fall back to StringIO in environments where cStringIO is not available
|
||||||
|
try:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
except ImportError:
|
||||||
|
from StringIO import StringIO
|
||||||
from reportlab.pdfgen import canvas
|
from reportlab.pdfgen import canvas
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue