[Setup] Re: Scripting ZOPE/Plone installation

Nick Davis nd51 at le.ac.uk
Thu Sep 28 16:01:13 UTC 2006


Duncan Mortimer wrote:

> get_transaction().commit()
> 
> Which results in...
> -c:1: DeprecationWarning: This will be removed in ZODB 3.6:
>    use transaction.get() instead of get_transaction().
Yes this is deprecated but still works - for future proofing you might 
want one the newer command.

Add the line  "import transaction" to the top of your script to make the 
newer one. It was that missing, which made it not work for you before.

> 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')
> AccessControl.unauthorized.Unauthorized: Cannot create Large Plone Folder
> 
> So, I've looked into authentication, and tried...
That's the right approach - the reason for your error was exactly what 
you thought, you need to become admin user first.


> 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.


Cheers
Nick

-- 
Nick Davis
Web Application Developer
University of Leicester
http://www2.le.ac.uk
http://ebulletin.le.ac.uk





More information about the Setup mailing list