From 6c947ffd97e6fd250e678ceb240a6b290945ecb8 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Tue, 9 Nov 2010 19:10:51 +0000
Subject: [PATCH] Workaround to make erp5_simulation_test installable when some
 portal types are missing

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40142 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_simulation/RuleMixin_asPredicate.xml             | 8 +++++++-
 bt5/erp5_simulation/bt/revision                           | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/RuleMixin_asPredicate.xml b/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/RuleMixin_asPredicate.xml
index d5fe7e426e..9c5d57f772 100644
--- a/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/RuleMixin_asPredicate.xml
+++ b/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/RuleMixin_asPredicate.xml
@@ -50,7 +50,12 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>return context.generatePredicate(criterion_property_list=("start_date",))\n
+            <value> <string>if context.getTypeInfo() is None:\n
+  # Workaround: unit tests don\'t always install all the BT that\n
+  # provide the portal types used by \'erp5_simulation_test\' BT.\n
+  return context\n
+\n
+return context.generatePredicate(criterion_property_list=("start_date",))\n
 </string> </value>
         </item>
         <item>
@@ -89,6 +94,7 @@
                           <tuple>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>None</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_simulation/bt/revision b/bt5/erp5_simulation/bt/revision
index aca544d017..bc768da71a 100644
--- a/bt5/erp5_simulation/bt/revision
+++ b/bt5/erp5_simulation/bt/revision
@@ -1 +1 @@
-145
\ No newline at end of file
+146
\ No newline at end of file
-- 
2.30.9