I do have that solution implemented just now but I thought of using File Storage seeing that I need to store additional user info such as address, email etc. anything else I can use ? Ruth ----- Original Message ----- From: "Andreas Jung" <andreas@andreas-jung.com> To: "Ruth Mizzi" <ruth@anvil.com>; <zope@zope.org> Sent: Tuesday, October 21, 2003 11:57 AM Subject: Re: [Zope] attributes Runtime error when using ZODB File Storage
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()
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )