[Erp5-report] r33761 fabien - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 16 17:07:49 CET 2010


Author: fabien
Date: Tue Mar 16 17:07:45 2010
New Revision: 33761

URL: http://svn.erp5.org?rev=33761&view=rev
Log:
revert r33615 : it's not good that getVariationCategoryList return categories
from the resource. We may want to use category defined manually on
transformation.

Modified:
    erp5/trunk/products/ERP5/Document/Transformation.py
    erp5/trunk/products/ERP5/tests/testTransformation.py

Modified: erp5/trunk/products/ERP5/Document/Transformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Transformation.py?rev=33761&r1=33760&r2=33761&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Transformation.py [utf8] Tue Mar 16 17:07:45 2010
@@ -184,20 +184,6 @@
       """
       self._setVariationBaseCategoryList(value)
       self.reindexObject()
-
-    security.declareProtected(Permissions.AccessContentsInformation,
-                              'getVariationCategoryList')
-    def getVariationCategoryList(self, **kwd):
-      """
-      Returns the variation categories applicable to the Transformation.
-      When a resource is defined, it should not return more than what is
-      set through the Resource.
-      """
-      resource = self.getResourceValue()
-      if resource is not None:
-        return resource.getVariationCategoryList(**kwd)
-      else:
-        return self.getVariationCategoryList(**kwd)
 
     security.declareProtected(Permissions.AccessContentsInformation,
                               'getVariationCategoryItemList')

Modified: erp5/trunk/products/ERP5/tests/testTransformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testTransformation.py?rev=33761&r1=33760&r2=33761&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testTransformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testTransformation.py [utf8] Tue Mar 16 17:07:45 2010
@@ -145,6 +145,36 @@
         swimcap.getVariationCategoryList(),
         transformation.getVariationCategoryList()
     )
+
+  def test_variationCategoryWithIndividualVariation(self):
+    '''Check that individual variation are return when getVariationCategoryList
+    is called on a transformation
+    '''
+    swimcap = self.createResource(
+        'Swimming Cap',
+        self.swimsuit_variation_base_category_list,
+        self.swimsuit_variation_category_list,
+    )
+    # create individual variation
+    individual_variation = swimcap.newContent(portal_type='Product Individual Variation')
+
+    transaction.commit()
+    self.tic()
+    transformation = self.createTransformation()
+    transformation.setResourceValue(swimcap)
+
+    transformation.edit(
+        title = 'Swimcap Production',
+        variation_base_category_list = \
+            self.swimsuit_variation_base_category_list + ['variation',]
+    )
+
+    # check the individual variation is returned by the
+    # getVariationCategoryList
+    individual_url = 'variation/%s' % individual_variation.getRelativeUrl()
+    self.assertTrue(individual_url in
+        transformation.getVariationCategoryList())
+
 
   def test_transformedInventory(self):
     portal = self.getPortal()




More information about the Erp5-report mailing list