Thanks for the quick reply, but it fails with a different error! The following is from a zopectl debug shell...

>>> import transaction
>>> from AccessControl.SecurityManagement import newSecurityManager
>>> adminuser = app.acl_users.getUser('adminuser')
>>> newSecurityManager(None, adminuser)
>>> plone_sites_folder = getattr(app, 'plone_sites')
>>> plone_sites_folder.manage_addProduct['CMFPlone'].manage_addSite ( id='test', title='test', description='test')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
File "/home/zope/client0/Products/CMFPlone/Portal.py", line 465, in manage_addSite
    p = gen.create(self, id.strip(), create_userfolder)
File "/home/zope/client0/Products/CMFPlone/Portal.py", line 434, in create
    parent._setObject(id, portal)
File "/home/zope/zope-2.8/lib/python/OFS/ObjectManager.py", line 295, in _setObject
    object.manage_fixupOwnershipAfterAdd()
File "/home/zope/zope-2.8/lib/python/AccessControl/Owned.py", line 257, in manage_fixupOwnershipAfterAdd
    self.changeOwnership(user)
File "/home/zope/zope-2.8/lib/python/AccessControl/Owned.py", line 147, in changeOwnership
    new=ownerInfo(user)
File "/home/zope/zope-2.8/lib/python/AccessControl/Owned.py", line 289, in ownerInfo
    db=user.aq_inner.aq_parent
AttributeError: aq_inner

It does create something, as subsequent efforts report...

zExceptions.BadRequest: The id "test" is invalid - it is already in use.

Thanks again.

On 28 Sep 2006, at 17:01, Nick Davis wrote:

Duncan Mortimer wrote:

from AccessControl.SecurityManagement import newSecurityManager
newSecurityManager(None, 'adminuser')
plone_sites_folder.manage_addProduct['CMFPlone'].manage_addSite ( id='cms', title='CMS', description='A CMS')

Here's your bug - you need this instead of your 2cnd line:

adminuser = app.acl_users.getUser('adminuser')
newSecurityManager(None,adminuser)


I'd appreciate some help on the matter, and also would like to put in a request for this kind of thing to be documented somewhere - all the sites I can find just talk about using the ZMI!
This is a problem in general. I personally prefer your approach of creating stuff using code, and feel the ZMI can get in the way. I feel your pain here. ;-)

You would find DocFinderTab v useful if you've not already got it. google for DocFinderTab for more info.

I'll look into that.

Thanks again

Duncan
--
Duncan A B Mortimer DPhil MChem
                Computing Officer, FMRIB Centre, University of Oxford,
              John Radcliffe Hospital, Headington, Oxford OX3 9DU, UK.
Tel: (0)1865 222713
WWW: http://www.fmrib.ox.ac.uk/~duncan    email: [EMAIL PROTECTED]



_______________________________________________
Setup mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/setup

Reply via email to