[Zope] attributes Runtime error when using ZODB File Storage

Ruth Mizzi ruth at anvil.com
Tue Oct 21 05:53:05 EDT 2003


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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.zope.org/pipermail/zope/attachments/20031021/f1a40c45/attachment.html


More information about the Zope mailing list