Commit 4241197b authored by Gabriel Hurley's avatar Gabriel Hurley
Browse files

[1.2.X] Improved example to account for environments where cStringIO is not...

[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
parent a96e50b7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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``::

    # 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