Re: [Zope] Adding many users
Ragnar Beer wrote: > > Howdy Zopistas and happy new year! > > I need to add about 150 users to an acl_users folder and I wouldn't > like to do it manually since the data already exists in a python > list. What would be an elegant way to add them all with a python > script? A script to put in lib/python, supplying your own user_role_name and user_list: user_list = ?? user_role_name = ?? import Zope app = Zope.app() folder = app.acl_users for u in user_list: folder._doAddUser(u.name, u.password, (user_role_name,), ()) get_transaction().commit() See how that works? Those first two lines give you the actual database--not just a special view of it but a live connection. From there, you don't use some funny mechanism to get acl_users--it's actually a simple attribute of the root object. Then you modify acl_users however you want and commit the transaction. If any error occurs, the transaction will be aborted and changes made to the database will be forgotten. Beautiful, isn't it? Shane ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Adding many users
Ragnar Beer writes: > I need to add about 150 users to an acl_users folder and I wouldn't > like to do it manually since the data already exists in a python > list. What would be an elegant way to add them all with a python > script? An external Python method or an external automation based on ZClient (Howto on zope.org). For both approaches, you must know the parameters of "manage_addUser". If nowhere else, you will find them in the source: "AccessControl.User.UserFolder.manage_addUser". Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Adding many users
Howdy Zopistas and happy new year! I need to add about 150 users to an acl_users folder and I wouldn't like to do it manually since the data already exists in a python list. What would be an elegant way to add them all with a python script? Ragnar ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )