I tried to add a plone user from a script that I ran with "./bin/instance run myscript.py"
ipdb>app.Plone.portal_groups.addPrinci开发者_如何学CpalToGroup('newuser', 'Administrators')
True
but when I check the web interface the user is not added to the group.
Although
ipdb>app.Plone.portal_groups.getGroupMembers('Administrators')
['newuser']
says otherwise.
When I run the same code in a normal plone instance (by opening a console with http://localhost:8080/Plone/ipdb) it works.
Do I have to commit the changes I made to ZODB or something like that?
You need to commit your transaction after doing all the changes
import transaction
# do some things
transaction.commit()
精彩评论