Hi, Thanks to Robert & Alexis I have a working solution: First I made a text file (usr_pwd.txt) in the form of password space username, and placed it (temporarily) in the Extensions directory. Then an external method (LoadUsers) to read it: def LoadUsers(self): f=open('/var/lib/zope/Extensions/usr_pwd.txt', 'r') y=f.readlines() return y And a script (user_load): ## Script (Python) "user_load" ##bind container=container ##bind context=context ##bind namespace=_ ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## y=context.LoadUsers() p=[] for x in y: z=x.split(' ') z0=z[0] z1=z[1] z1=z1[:-1] acl = container.restrictedTraverse( '/foobar/acl_users' ) acl.userFolderAddUser( z1, z0, p, '' ) return 0 Sean
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - --On 3. Januar 2007 14:42:58 -0600 Sean Duffy <swduffy@unmc.edu> wrote:
y=context.LoadUsers() p=[] for x in y: z=x.split(' ') z0=z[0] z1=z[1] z1=z1[:-1] ^^^^^^^^^^^^^^^^^
Don't do that. Python strings have a strip() method. Especially this code won't work with files with DOS line-endings. - -aj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (Darwin) iD8DBQFFnBdQCJIWIbr9KYwRAnB3AKCkU5D2nAw7oU7/uQ3CTVwTweHAZQCfdSyT 32wmytjeXlyRgSL/2+dlGsU= =uAn5 -----END PGP SIGNATURE-----
participants (2)
-
Andreas Jung -
Sean Duffy