--- a/src/reportlab/graphics/charts/legends.py Wed Sep 17 12:56:33 2008 +0000
+++ b/src/reportlab/graphics/charts/legends.py Wed Sep 17 14:43:19 2008 +0000
@@ -74,7 +74,7 @@
fN = getattr(sc,'fontName',fontName)
fS = getattr(sc,'fontSize',fontSize)
m = [stringWidth(x, fN, fS) for x in s.split('\n')]
- aS(max(subCols[0,i],m and max(m) or 0))
+ aS(max(sc.minWidth,m and max(m) or 0))
return S
class SubColProperty(PropHolder):
--- a/src/reportlab/pdfbase/cidfonts.py Wed Sep 17 12:56:33 2008 +0000
+++ b/src/reportlab/pdfbase/cidfonts.py Wed Sep 17 14:43:19 2008 +0000
@@ -12,8 +12,11 @@
from types import ListType, TupleType, DictType
from string import find, split, strip
import marshal
-import md5
import time
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
import reportlab
from reportlab.pdfbase import pdfmetrics
@@ -88,7 +91,7 @@
self.parseCMAPFile(name)
def _hash(self, text):
- hasher = md5.new()
+ hasher = md5()
hasher.update(text)
return hasher.digest()
--- a/src/reportlab/pdfbase/pdfdoc.py Wed Sep 17 12:56:33 2008 +0000
+++ b/src/reportlab/pdfbase/pdfdoc.py Wed Sep 17 14:43:19 2008 +0000
@@ -20,6 +20,10 @@
from reportlab import rl_config
from reportlab.lib.utils import import_zlib, open_for_read, fp_str, _digester
from reportlab.pdfbase import pdfmetrics
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
from sys import platform
try:
@@ -150,8 +154,7 @@
self.invariant = invariant
self.setCompression(compression)
# signature for creating PDF ID
- import md5
- sig = self.signature = md5.new()
+ sig = self.signature = md5()
sig.update("a reportlab document")
if not self.invariant:
cat = _getTimeStamp()
@@ -2053,7 +2056,7 @@
if not zlib: return
self.width, self.height = im.getSize()
raw = im.getRGBData()
- assert(len(raw) == self.width*self.height, "Wrong amount of data for image")
+ #assert len(raw) == self.width*self.height, "Wrong amount of data for image expected %sx%s=%s got %s" % (self.width,self.height,self.width*self.height,len(raw))
self.streamContent = pdfutils._AsciiBase85Encode(zlib.compress(raw))
self.colorSpace= _mode2CS[im.mode]
self.bitsPerComponent = 8
--- a/src/reportlab/pdfgen/canvas.py Wed Sep 17 12:56:33 2008 +0000
+++ b/src/reportlab/pdfgen/canvas.py Wed Sep 17 14:43:19 2008 +0000
@@ -14,7 +14,10 @@
import tempfile
from types import *
from math import sin, cos, tan, pi, ceil
-import md5
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
from reportlab import rl_config
from reportlab.pdfbase import pdfutils
@@ -734,7 +737,7 @@
will error in Distiller but work on printers supporting it.
"""
#check if we've done this one already...
- rawName = 'PS' + md5.md5(command).hexdigest()
+ rawName = 'PS' + md5(command).hexdigest()
regName = self._doc.getXObjectName(rawName)
psObj = self._doc.idToObject.get(regName, None)
if not psObj:
--- a/src/reportlab/pdfgen/pdfimages.py Wed Sep 17 12:56:33 2008 +0000
+++ b/src/reportlab/pdfgen/pdfimages.py Wed Sep 17 14:43:19 2008 +0000
@@ -105,7 +105,7 @@
#use a flate filter and Ascii Base 85 to compress
raw = myimage.tostring()
- assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image")
+ assert len(raw) == imgwidth*imgheight*3, "Wrong amount of data for image"
compressed = zlib.compress(raw) #this bit is very fast...
encoded = pdfutils._AsciiBase85Encode(compressed) #...sadly this may not be
#append in blocks of 60 characters
--- a/tests/test_docs_build.py Wed Sep 17 12:56:33 2008 +0000
+++ b/tests/test_docs_build.py Wed Sep 17 14:43:19 2008 +0000
@@ -11,7 +11,11 @@
def test0(self):
"Test if all manuals buildable from source."
from reportlab.lib.testutils import testsFolder
- docsFolder = os.path.join(testsFolder,'..','docs')
+ try:
+ docsFolder = os.path.join(os.path.dirname(testsFolder),'docs')
+ except:
+ print testsFolder
+ raise
cwd = os.getcwd()
os.chdir(docsFolder)
try:
--- a/tests/test_images.py Wed Sep 17 12:56:33 2008 +0000
+++ b/tests/test_images.py Wed Sep 17 14:43:19 2008 +0000
@@ -7,7 +7,11 @@
Most of them make use of test\pythonpowereed.gif."""
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
setOutDir(__name__)
-import os,md5
+import os
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
import unittest
from reportlab.lib.utils import ImageReader
@@ -36,7 +40,7 @@
ir = ImageReader(imageFileName)
assert ir.getSize() == (110,44)
pixels = ir.getRGBData()
- assert md5.md5(pixels).hexdigest() == '02e000bf3ffcefe9fc9660c95d7e27cf'
+ assert md5(pixels).hexdigest() == '02e000bf3ffcefe9fc9660c95d7e27cf'
def makeSuite():
return makeSuiteForClasses(ReaderTestCase)