[Erp5-report] r41704 nicolas - /erp5/trunk/products/ERP5/mixin/downloadable.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 23 12:00:32 CET 2010


Author: nicolas
Date: Thu Dec 23 12:00:32 2010
New Revision: 41704

URL: http://svn.erp5.org?rev=41704&view=rev
Log:
Be more tolerant against previous implementation
Done by JPS

Modified:
    erp5/trunk/products/ERP5/mixin/downloadable.py

Modified: erp5/trunk/products/ERP5/mixin/downloadable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/downloadable.py?rev=41704&r1=41703&r2=41704&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/downloadable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/downloadable.py [utf8] Thu Dec 23 12:00:32 2010
@@ -114,13 +114,18 @@ class DownloadableMixin:
     """Returns the document coordinates as a standard file name. This
     method is the reverse of getPropertyDictFromFileName.
     """
-    method = self._getTypeBasedMethod('getStandardFilename',
+    try:
+      method = self._getTypeBasedMethod('getStandardFilename',
                              fallback_script_id='Document_getStandardFilename')
-    if method is None:
+    except AttributeError:
       # backward compatibility
       method = self._getTypeBasedMethod('getStandardFileName',
                              fallback_script_id='Document_getStandardFileName')
-    return method(format=format)
+    try:
+      return method(format=format)
+    except TypeError:
+      # Old versions of this script did not support 'format' parameter
+      return method()
 
   # backward compatibility
   security.declareProtected(Permissions.AccessContentsInformation,



More information about the Erp5-report mailing list