[Erp5-report] r14070 - /erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Apr 13 16:03:15 CEST 2007
Author: jerome
Date: Fri Apr 13 16:03:10 2007
New Revision: 14070
URL: http://svn.erp5.org?rev=14070&view=rev
Log:
add compatibility support for old versions of oood without getAllowedTargetList
method.
Modified:
erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
Modified: erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Document/OOoDocument.py?rev=14070&r1=14069&r2=14070&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/OOoDocument.py (original)
+++ erp5/trunk/products/ERP5OOo/Document/OOoDocument.py Fri Apr 13 16:03:10 2007
@@ -32,6 +32,7 @@
import zipfile
import cStringIO
import socket
+from warnings import warn
from DateTime import DateTime
from AccessControl import ClassSecurityInfo
@@ -176,7 +177,8 @@
allow_none=True)
return server_proxy
- security.declareProtected(Permissions.AccessContentsInformation,'getTargetFormatList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getTargetFormatItemList')
def getTargetFormatItemList(self):
"""
Returns a list of acceptable formats for conversion
@@ -187,13 +189,22 @@
"""
def cached_getTargetFormatItemList(content_type):
server_proxy = self._mkProxy()
- allowed = server_proxy.getAllowedTargetItemList(content_type) # oood API needs naming convention update
- return [(y, x) for x, y in allowed] # tuple order is reversed to be compatible with ERP5 Form
+ try:
+ allowed = server_proxy.getAllowedTargetItemList(content_type)
+ except Fault, f:
+ allowed = server_proxy.getAllowedTargets(content_type)
+ warn('Your oood version is too old, using old method '
+ 'getAllowedTargets instead of getAllowedTargetList',
+ DeprecationWarning)
+
+ # tuple order is reversed to be compatible with ERP5 Form
+ return [(y, x) for x, y in allowed]
# Cache valid format list
- cached_getTargetFormatItemList = CachingMethod(cached_getTargetFormatItemList,
- id = "OOoDocument_getTargetFormatItemList",
- cache_factory='erp5_ui_medium')
+ cached_getTargetFormatItemList = CachingMethod(
+ cached_getTargetFormatItemList,
+ id="OOoDocument_getTargetFormatItemList",
+ cache_factory='erp5_ui_medium')
return cached_getTargetFormatItemList(self.getBaseContentType())
More information about the Erp5-report
mailing list