[Erp5-report] r13811 - in /erp5/trunk/products/ERP5Form: ./ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 30 10:12:29 CEST 2007


Author: kazuhiko
Date: Fri Mar 30 10:12:22 2007
New Revision: 13811

URL: http://svn.erp5.org?rev=13811&view=rev
Log:
support calling with getSelectionNames() for backward compatibility.

Modified:
    erp5/trunk/products/ERP5Form/SelectionTool.py
    erp5/trunk/products/ERP5Form/tests/testSelectionTool.py

Modified: erp5/trunk/products/ERP5Form/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/SelectionTool.py?rev=13811&r1=13810&r2=13811&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/SelectionTool.py (original)
+++ erp5/trunk/products/ERP5Form/SelectionTool.py Fri Mar 30 10:12:22 2007
@@ -114,7 +114,8 @@
         del REQUEST.form['report_depth']
 
       if query_string is not None:
-        LOG('SelectionTool', 0, 'DEPRECATED: _redirectToOriginalForm got called with a query_string. The variables must be passed in REQUEST.form.')
+        warnings.warn('DEPRECATED: _redirectToOriginalForm got called with a query_string. The variables must be passed in REQUEST.form.',
+                      DeprecationWarning)
       context = REQUEST['PARENTS'][0]
       form_id = dialog_id or REQUEST.get('dialog_id', None) or form_id or REQUEST.get('form_id', 'view')
       return getattr(context, form_id)()
@@ -131,6 +132,14 @@
         prefix = '%s-' % user_id
         return [x.replace(prefix, '', 1) for x in self.getSelectionContainer().keys() if x.startswith(prefix)]
       return []
+
+    # backward compatibility
+    security.declareProtected(ERP5Permissions.View, 'getSelectionNames')
+    def getSelectionNames(self, context=None, REQUEST=None):
+      warnings.warn("getSelectionNames() is deprecated.\n"
+                    "Please use getSelectionNameList() instead.",
+                    DeprecationWarning)
+      return self.getSelectionNameList(context, REQUEST)
 
     security.declareProtected(ERP5Permissions.View, 'callSelectionFor')
     def callSelectionFor(self, selection_name, context=None, REQUEST=None):

Modified: erp5/trunk/products/ERP5Form/tests/testSelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testSelectionTool.py?rev=13811&r1=13810&r2=13811&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testSelectionTool.py (original)
+++ erp5/trunk/products/ERP5Form/tests/testSelectionTool.py Fri Mar 30 10:12:22 2007
@@ -68,7 +68,11 @@
       from Products.ERP5Form.SelectionTool import SelectionError
       self.assertRaises(SelectionError,
                         self.portal_selections.getSelectionNameList)
+      self.assertRaises(SelectionError,
+                        self.portal_selections.getSelectionNames)
     else:
+      self.assertEquals(['test_selection'],
+                        self.portal_selections.getSelectionNames())
       self.assertEquals(['test_selection'],
                         self.portal_selections.getSelectionNameList())
 




More information about the Erp5-report mailing list