I explain a usecase:
- You have to create an entity, like a company, into the portal.
- You need to have a few users associated to that company, like a Manager, a Reviewer, etc.
The way to do it is simple:
0. Import necessary modules.
from Products.CMFCore.utils import getToolByName
1. Take the directory where you need to create the entries.
directories = getToolByName(context, 'portal_directories')
my_dir = directories['my_dir']
2. Create the entry.
my_entry = {'id' : 'my_id',
'name' : 'my_name',
'data' : 'some other data'}
3. Insert the entry.
my_dir.createEntry(my_entry)
It also be useful to create test data.
No comments:
Post a Comment