[pod] When inserting an image via statement do... from document(...), parameter 'sizeUnit' can now be 'pc' (percentage): in this case, percentages are expressed as a tuple (widthPercentage, heightPercentage) in parameter 'size' and must be integers from 1 to 100. [bin] backup.py: better error handling when contacting SMTP server. [gen] Calendar widget for Date fields: bugfix (when the date range is in reverse chronological order). [gen] Ref field: added hook 'afterLink' allowing to execute a method just after an object has been linked. [gen] Ref field: added attribute 'unlinkElement' allowing to define a specific condition for unlinking a given object (before, it was only possible to define, in attribute 'unlink', a global condition allowing to unlink any object from the Ref. [gen] Bugfix: the link to the home page, when clicking on the logo, is fixed.

This commit is contained in:
Gaetan Delannay 2014-07-10 09:46:39 +02:00
parent 268309045a
commit 25f0e8184e
10 changed files with 58 additions and 19 deletions

View file

@ -54,7 +54,6 @@ class BufferAction:
'''Gets the line describing exception p_e, containing the exception
class, message and line number.'''
return '%s: %s' % (e.__class__.__name__, str(e))
return '%s.%s: %s' % (e.__module__, e.__class__.__name__, str(e))
def manageError(self, result, context, errorMessage, dumpTb=True):
'''Manage the encountered error: dump it into the buffer or raise an

View file

@ -383,7 +383,7 @@ class ImageImporter(DocImporter):
self.format = 'png'
# Retrieve image size from self.size.
width = height = None
if self.size:
if self.size and (self.sizeUnit != 'pc'):
width, height = self.size
if self.sizeUnit == 'px':
# Convert it to cm
@ -397,6 +397,10 @@ class ImageImporter(DocImporter):
# If width and/or height is missing, compute it.
if not width or not height:
width, height = getSize(self.importPath, self.format)
if self.sizeUnit == 'pc':
# Apply the given percentage to the real width and height.
width = width * (float(self.size[0])/100)
height = height * (float(self.size[1])/100)
if width != None:
size = ' %s:width="%fcm" %s:height="%fcm"' % (s, width, s, height)
else:

View file

@ -314,7 +314,8 @@ class Renderer:
(width, height) expressing size in p_sizeUnit (see below).
If not specified, size will be computed from image info;
* p_sizeUnit is the unit for p_size elements, it can be "cm"
(centimeters) or "px" (pixels);
(centimeters), "px" (pixels) or "pc" (percentage). Percentages, in
p_size, must be expressed as integers from 1 to 100.
* if p_style is given, it is the content of a "style" attribute,
containing CSS attributes. If "width" and "heigth" attributes are
found there, they will override p_size and p_sizeUnit.