"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xhtml2pdf/util.py" between
xhtml2pdf-0.2.6.tar.gz and xhtml2pdf-0.2.7.tar.gz

About: xhtml2pdf is a HTML/CSS to PDF converter written in Python.

util.py  (xhtml2pdf-0.2.6):util.py  (xhtml2pdf-0.2.7)
skipping to change at line 39 skipping to change at line 39
from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont from reportlab.pdfbase.cidfonts import UnicodeCIDFont
import xhtml2pdf.default import xhtml2pdf.default
rgb_re = re.compile( rgb_re = re.compile(
r"^.*?rgb[a]?[(]([0-9]+).*?([0-9]+).*?([0-9]+)(?:.*?(?:[01]\.(?:[0-9]+)))?[) ].*?[ ]*$") r"^.*?rgb[a]?[(]([0-9]+).*?([0-9]+).*?([0-9]+)(?:.*?(?:[01]\.(?:[0-9]+)))?[) ].*?[ ]*$")
log = logging.getLogger("xhtml2pdf") log = logging.getLogger("xhtml2pdf")
try: import PyPDF3
import PyPDF3 from reportlab.graphics import renderPM
except ImportError: from reportlab.graphics import renderSVG
PyPDF3 = None
try:
from reportlab.graphics import renderPM
except ImportError:
renderPM = None
try:
from reportlab.graphics import renderSVG
except ImportError:
renderSVG = None
#========================================================================= #=========================================================================
# Memoize decorator # Memoize decorator
#========================================================================= #=========================================================================
class memoized(object): class memoized(object):
""" """
A kwargs-aware memoizer, better than the one in python :) A kwargs-aware memoizer, better than the one in python :)
skipping to change at line 386 skipping to change at line 375
position = str(position).split() position = str(position).split()
if len(position) != 2: if len(position) != 2:
raise Exception("position not defined right way") raise Exception("position not defined right way")
x, y = [getSize(pos) for pos in position] x, y = [getSize(pos) for pos in position]
return getCoords(x, y, None, None, pagesize) return getCoords(x, y, None, None, pagesize)
def getBool(s): def getBool(s):
" Is it a boolean? " " Is it a boolean? "
return str(s).lower() in ("y", "yes", "1", "true") return str(s).lower() in ("y", "yes", "1", "true")
def getFloat(s):
try:
s = float(s)
except:
pass
return s
_uid = 0 _uid = 0
def getUID(): def getUID():
" Unique ID " " Unique ID "
global _uid global _uid
_uid += 1 _uid += 1
return str(_uid) return str(_uid)
_alignments = { _alignments = {
"left": TA_LEFT, "left": TA_LEFT,
 End of changes. 2 change blocks. 
14 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)