[Erp5-report] r35772 nicolas - /erp5/trunk/products/ERP5/mixin/document.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 31 11:54:45 CEST 2010


Author: nicolas
Date: Mon May 31 11:54:37 2010
New Revision: 35772

URL: http://svn.erp5.org?rev=35772&view=rev
Log:
Provide Backward compatibility code for existing type based method
which doesn't support new **kw parameter.

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

Modified: erp5/trunk/products/ERP5/mixin/document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/document.py?rev=35772&r1=35771&r2=35772&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/document.py [utf8] Mon May 31 11:54:37 2010
@@ -87,7 +87,14 @@
     # XXX cache result in TV
     method = self._getTypeBasedMethod('checkConversionFormatPermission',
                  fallback_script_id='Document_checkConversionFormatPermission')
-    if not method(format=format, **kw):
+    if '**kw' not in method.params():
+      # Backward compatibility code:
+      # Existing Type Based Method doesn't support new **kw argument
+      # in their signature.
+      is_allowed = method(format=format)
+    else:
+      is_allowed = method(format=format, **kw)
+    if not is_allowed:
       raise Unauthorized('Document: user does not have enough permission'\
                          ' to access document in %s format' %\
                                                         (format or 'original'))




More information about the Erp5-report mailing list