erp5_core: reindex recursively only if indexable children type exists in...

erp5_core: reindex recursively only if indexable children type exists in Base_reindexObjectSecurity.

This is important especially for SyncML Subscription having tons of SyncML Signatures that is non-indexable.

Note: first I tried the change in the restricted python only like :

--- product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_reindexObjectSecurity.py
+++ product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_reindexObjectSecurity.py
@@ -4,7 +4,8 @@
 # with lots of content could mean hours of non-usable overloaded system.
 type_tool = context.getPortalObject().portal_types
 for portal_type_name in context.getTypeInfo().getTypeAllowedContentTypeList():
-  if getattr(type_tool, portal_type_name).getTypeAcquireLocalRole():
+  if getattr(type_tool, portal_type_name).getTypeAcquireLocalRole() and \
+      type_tool.getPortalTypeClass(portal_type_name).isIndexable():
     reindex = context.recursiveReindexObject
     break
 else:

but I got the following exception :

  File "Script (Python)", line 8, in Base_reindexObjectSecurity
    type_tool.getPortalTypeClass(portal_type_name).isIndexable():
  File "/(SR)/eggs/AccessControl-4.4-py2.7-linux-x86_64.egg/AccessControl/users.py", line 179, in allowed
    if self._check_context(object):
  File "/(SR)/parts/erp5/product/ERP5Type/patches/AccessControl_patch.py", line 44, in _check_context
    return aq_inContextOf(getattr(object, '__self__', object), context, 1)
TypeError: unbound method _aq_dynamic() must be called with Address instance as first argument (got str instance instead)
5 jobs for master in 0 seconds
Status Job ID Name Coverage
  External
failed ERP5.PerformanceTest-Master

00:34:43

failed ERP5.UnitTest-Master

02:37:28

passed SlapOS.Eggs.UnitTest-Master.Python2

00:27:53

passed SlapOS.Eggs.UnitTest-Master.Python3

00:26:39

passed Wendelin.UnitTest-Master

00:38:53