From b1d69cfd0fcd8492d50f4f5091bb679f4ebf72c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 18 Apr 2006 11:08:46 +0000
Subject: [PATCH] check person_module is present before reindexing it

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6777 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_core/ERP5Site_reindexAll.xml         | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_reindexAll.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_reindexAll.xml
index 274647dc5c..d33f000f28 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_reindexAll.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_reindexAll.xml
@@ -67,15 +67,15 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>print "#### Indexing person_module, stage 1 ####"\n
-person_module=context.getPortalObject().person_module\n
-person_module.reindexObject(tag=\'person_stage_1\',\n
-                            sql_catalog_id=sql_catalog_id,\n
-                            passive_commit=passive_commit)\n
-for o in person_module.objectValues():\n
-  o.recursiveReindexObject(tag=\'person_stage_1\',\n
-                           sql_catalog_id=sql_catalog_id,\n
-                           passive_commit=passive_commit)\n
-\n
+person_module=getattr(context.getPortalObject(), \'person_module\', None)\n
+if person_module is not None :\n
+  person_module.reindexObject(tag=\'person_stage_1\',\n
+                              sql_catalog_id=sql_catalog_id,\n
+                              passive_commit=passive_commit)\n
+  for o in person_module.objectValues():\n
+    o.recursiveReindexObject(tag=\'person_stage_1\',\n
+                             sql_catalog_id=sql_catalog_id,\n
+                             passive_commit=passive_commit)\n
 \n
 print "#### Indexing translations ####"\n
 context.ERP5Site_updateTranslationTable(after_tag=(\'person_stage_1\', ),\n
@@ -301,8 +301,10 @@ return printed\n
                             <string>passive_commit</string>
                             <string>_print_</string>
                             <string>_print</string>
+                            <string>getattr</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>None</string>
                             <string>person_module</string>
                             <string>_getiter_</string>
                             <string>o</string>
-- 
2.30.9