Very sick idea :-)I acl_users._doAddUser(name, password, roles, domains) does the job for you. See AccessControl/User.py -aj --On Dienstag, 21. Oktober 2003 11:53 Uhr +0200 Ruth Mizzi <ruth@anvil.com> wrote:
Hi,
I'm using the ZODB storage for the first time and am basically tring to add some user info to a FileStorage object. My code is a python script pasted below. My problem is that when I'm trying to test this in the Zope management interface I keep getting the error:
Error Type: RuntimeError Error Value: function attributes not accessible in restricted mode
.... any idea what could be causing this problem and, more importantly, how I can solve it??
Cheers
Ruth
import ZODB from ZODB import DB from ZODB.FileStorage import FileStorage from ZODB.PersistentMapping import PersistentMapping from Persistence import Persistent
class AnvilUser(Persistent): def setUserName(self, username): self.username = username def setFullName(self, fname): self.fname = fname def setSurName(self, surname): self.surname = surname def setEMail(self, email): self.email = email
storage = FileStorage('anvilusers.fs') db = DB(storage) connection = db.open() root = connection.root() if not root.has_key('users'):root["users"] = {} users = root['users'] anviluser = AnvilUser() anviluser.setUsername(username) anviluser.setFullName(fname) anviluser.setSurName(surname) anviluser.setEMail(email) users.append(anviluser) root['users'] = users get_transaction.commit() connection.close()