support both older and newer versions of reportlab

closes #71
This commit is contained in:
fritz-hh 2014-04-27 15:53:20 +02:00
parent 3546f84c6d
commit b70863b47e

View File

@ -14,7 +14,6 @@ from PIL import Image
import re, sys
import argparse
def monkeypatch_method(cls):
'''
Override a class method at runtime.
@ -47,8 +46,13 @@ def PIL_imagedata(self):
from reportlab.lib.utils import import_zlib
from reportlab import rl_config
from reportlab.pdfbase.pdfutils import _AsciiBase85Encode, _chunker
from reportlab.pdfbase.pdfutils import _chunker
# in order to support both newer and older versions of reportlab
try:
from reportlab.pdfbase.pdfutils import _AsciiBase85Encode
except ImportError:
from reportlab.pdfbase.pdfutils import _asciiBase85Encode as _AsciiBase85Encode
self.source = 'PIL'
zlib = import_zlib()
if not zlib: