From 80a80f4b05984345a651e449d96005cb48513527 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Thu, 23 Dec 2010 11:00:32 +0000
Subject: [PATCH] Be more tolerant against previous implementation Done by JPS

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41704 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/mixin/downloadable.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/mixin/downloadable.py b/product/ERP5/mixin/downloadable.py
index 69df524256..2fbfbb0e30 100644
--- a/product/ERP5/mixin/downloadable.py
+++ b/product/ERP5/mixin/downloadable.py
@@ -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,
-- 
2.30.9