Commit d7267ffd authored by Nicolas Delaby's avatar Nicolas Delaby

Provide Backward compatibility code for existing type based method

which doesn't support new **kw parameter.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35772 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 21c17f1e
......@@ -87,7 +87,14 @@ class DocumentMixin:
# 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'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment