[Erp5-report] r13764 - /erp5/trunk/products/ERP5OOo/OOoTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 28 17:05:00 CEST 2007


Author: alex
Date: Wed Mar 28 17:04:59 2007
New Revision: 13764

URL: http://svn.erp5.org?rev=13764&view=rev
Log:
include ERP5.Document.Image API when getting image width and height

Modified:
    erp5/trunk/products/ERP5OOo/OOoTemplate.py

Modified: erp5/trunk/products/ERP5OOo/OOoTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/OOoTemplate.py?rev=13764&r1=13763&r2=13764&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/OOoTemplate.py (original)
+++ erp5/trunk/products/ERP5OOo/OOoTemplate.py Wed Mar 28 17:04:59 2007
@@ -339,10 +339,13 @@
 
       w, h, maxwidth, maxheight = getLengthInfos( options_dict, ('width','height','maxwidth','maxheight') )
 
-      try:
+      try: # try image properties
         aspect_ratio = float(picture.width) / float(picture.height)
       except (TypeError, ZeroDivisionError):
-        aspect_ratio = float(picture.width()) / float(picture.height())
+        try: # try ERP5.Document.Image API
+          aspect_ratio = float(picture.getWidth()) / float(picture.getHeight())
+        except AttributeError: # fallback to Photo API
+          aspect_ratio = float(picture.width()) / float(picture.height())
       # fix a default value and correct the aspect
       if h is None:
         if w is None:




More information about the Erp5-report mailing list