[Zope] Monkeying with the Zope database
Steve Jibson
stevej@parlant.com
Mon, 13 Nov 2000 14:15:48 -0700
I've been toying with the Zope database and I'm probably alomst to the
point where I know enough to be dangerous.
I am trying to make a few changes to the stuff in the Zope database
without actually running Zope.
Here's what I'm tring to do:
1 - Create a new user in the top level acl_users folder
2 - import a file "login.zexp" into the top level folder (login.zexp has
been copied to the import directory)
Here's some code I've written:
------------------
import sys
sys.path.insert(0, '/home/zope/lib/python')
import Zope
appRoot = Zope.DB.open().root()['Application']
# create a new user
appRoot['acl_users']._doAddUser(name='ThisWebSiteIsMine-SoThere',
password='pw',
roles=['Manager'],
domains=[])
get_transaction().commit()
# login as that user
owner = appRoot['acl_users'].getUserById('ThisWebSiteIsMine-SoThere')
Zope.AccessControl.SecurityManagement.newSecurityManager(None, owner)
# import login.zexp and take ownership
appRoot.manage_importObject('login.zexp', set_owner=1)
get_transaction().commit()
------------------
Here's the resulting traceback:
------------------
Traceback (innermost last):
File "go.py", line 22, in ?
appRoot.manage_importObject('login.zexp', set_owner=1)
File "/home/zope/lib/python/OFS/ObjectManager.py", line 526, in
manage_importObject
self._setObject(id, ob, set_owner=set_owner)
File "/home/zope/lib/python/OFS/ObjectManager.py", line 267, in
_setObject
object.manage_fixupOwnershipAfterAdd()
File "/home/zope/lib/python/AccessControl/Owned.py", line 273, in
manage_fixupOwnershipAfterAdd
self.changeOwnership(user)
File "/home/zope/lib/python/AccessControl/Owned.py", line 166, in
changeOwnership
new=ownerInfo(user)
File "/home/zope/lib/python/AccessControl/Owned.py", line 297, in
ownerInfo
db=user.aq_inner.aq_parent
AttributeError: aq_inner
------------------
It appears to be dying while trying to set the ownership.
There's a good chance that I'm going about this all the wrong way (I'm
new at this stuff).
Any help to fix up what I've tryed or new ways to approach the problem
will be appreciated.
Thanks,
Steve