开发者

How to add plone group members from script

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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜