Commit c032efac authored by Vincent Pelletier's avatar Vincent Pelletier

all: Avoid remaining direct calls to {recursiveI,i}mmediateReindexObject

Also, simplify scripts while doing so.
parent 59e7ed29
""" This script reindex all the objects created before updating local roles """
module_list = ['document_module',
'image_module',
'knowledge_pad_module',
'organisation_module',
'person_module',
'review_module',
'test_page_module',
'web_page_module',
'web_site_module']
context.portal_types.Folder_reindexAll()
portal = context.getPortalObject()
for module_id in module_list:
stack = [getattr(portal, module_id)]
for obj in stack:
for child in obj.objectValues():
stack.append(child)
portal.portal_types.Folder_reindexAll()
stack = [
portal.document_module,
portal.image_module,
portal.knowledge_pad_module,
portal.organisation_module,
portal.person_module,
portal.review_module,
portal.test_page_module,
portal.web_page_module,
portal.web_site_module,
]
for obj in stack:
stack.extend(obj.objectValues())
obj.updateLocalRolesOnSecurityGroups()
......@@ -46,13 +46,8 @@ if person_list:
# create Person account
person_module = portal.getDefaultModule(portal_type='Person')
person = person_module.newContent(portal_type='Person', **kw)
person = person_module.newContent(reindex_on_commit=True, portal_type='Person', **kw)
person.validate()
# do not immediate reindex object
# this means that when creating an account the new one will *NOT*
# be available immediately and we should consider sending two email to user
# that 1) his account will be created and when created 2)-> send account info
#person.immediateReindexObject()
# Create default career
person.newContent(portal_type='Career',
......
......@@ -2,12 +2,5 @@ foo1 = context.foo_module.newContent(portal_type='Foo')
foo2 = context.foo_module.newContent(portal_type='Foo')
foo1.setTitle('hasAccessUnauthorized')
foo1.setSuccessorValue(foo2)
foo1.immediateReindexObject()
foo2.immediateReindexObject()
foo2.activate().manage_permission( 'Access contents information', 'Manager', 0)
foo2.activate().manage_permission('Access contents information', 'Manager', 0)
return 'Done'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment