Hi, I'm in the progress of setting up a medium sized Plone installation. I'm very new to Python/Zope/Plone, so am struggling a little. What I would like to be able to do is write a script to build the entire Zope/Plone instance from sources and the configure it automatically via 'zopectl run <script>'. The setup is as follows: Zope 2.8.7-final ZEO server 4 zope clients Plone 2.1.4 I've built a bash script which builds and installs the sources and then re-writes the config files to point at the ZEO server. I then want to create a folder in the root of the Zope instance to hold several Plone sites. So far, I've been able to create the folder with: app.manage_addFolder('plone_sites','Plone Sites') get_transaction().commit() Which results in... -c:1: DeprecationWarning: This will be removed in ZODB 3.6: use transaction.get() instead of get_transaction(). transaction.commit() is a shortcut spelling of transaction.get().commit(), and transaction.abort() of transaction.get().abort(). I've tried using the methods described in the warning, but with no success... >>> transaction.commit() Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 'transaction' is not defined >>> app.transaction.commit() Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: transaction >>> transaction.get().commit() Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 'transaction' is not defined >>> app.transaction.get().commit() Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: transaction Anyway, as the folder gets created I'm not too worried about this. The next step is to create the Plone sites. Looking through the CMFPlone folder I've discovered the method manage_addSite which looks like it is being called by the ZMI on site creation, so... plone_sites_folder = getattr(app, 'plone_sites') plone_sites_folder.manage_addProduct['CMFPlone'].manage_addSite( id='cms', title='CMS', description='A CMS') gives the error... 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 437, in create self.setupPlone(p) File "/home/zope/client0/Products/CMFPlone/Portal.py", line 384, in setupPlone self.setupPortalContent(p) File "/home/zope/client0/Products/CMFPlone/Portal.py", line 223, in setupPortalContent p.invokeFactory('Large Plone Folder', 'Members') File "/home/zope/client0/Products/CMFCore/PortalFolder.py", line 408, in invokeFactory return pt.constructContent(type_name, self, id, RESPONSE, *args, **kw) File "/home/zope/client0/Products/CMFCore/TypesTool.py", line 925, in constructContent ob = info.constructInstance(container, id, *args, **kw) File "/home/zope/client0/Products/CMFCore/TypesTool.py", line 333, in constructInstance raise AccessControl_Unauthorized('Cannot create %s' % self.getId()) AccessControl.unauthorized.Unauthorized: Cannot create Large Plone Folder So, I've looked into authentication, and tried... from AccessControl.SecurityManagement import newSecurityManager newSecurityManager(None, 'adminuser') plone_sites_folder.manage_addProduct['CMFPlone'].manage_addSite( id='cms', title='CMS', description='A CMS') gives... 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 287, in ownerInfo uid=user.getId() AttributeError: 'str' object has no attribute 'getId' So I guess that isn't much use. 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! Thanks Duncan |
_______________________________________________ Setup mailing list [email protected] http://lists.plone.org/mailman/listinfo/setup
