You are here: Home / Documentation / How To's / How to upgrade plone.portlet.static 1.1.5 on Plone 3.1.7

How to upgrade plone.portlet.static 1.1.5 on Plone 3.1.7

by nguyen — published Mar 24, 2011 12:20 PM, last modified Aug 16, 2016 10:50 AM
plone.recipe.plone buildout recipe fixes plone.portlet.static to 1.1.5 but you want to upgrade to 1.2rc1 or 2.0.1

The problem

Plone 3.1.7 uses plone.recipe.plone, which specifies that you will use plone.portlet.static 1.1.5.  The problem with that version of plone.portlet.static is that it requires "Manage portal" permission to edit static text portlets.  Version 1.2rc1 and up require (more correctly) a new permission "Add static portlet", which means you can grant that permission to a role without having to hand over the keys to the kingdom.

Normally, with Plone versions greater than 3.1.7, it would suffice to add this to your [versions] section:

plone.portlet.static = 1.2rc1

then rerun buildout.  But with Plone 3.1.7, you get a message like

The version, 1.2rc1, is not consistent with the requirement, 'plone.portlet.static==1.1.5'.

Failed attempts

Some of the methods I attempted but ultimately gave up on:

  • Using part of the solution described below, I overrode the Plone recipe to require plone.portlet.static 1.2rc1.  This ended up pulling down many zope.* eggs such as zope.component, zope.browser, pytz, etc.  
  • I attempted to pin the versions of those fetched eggs, using the [versions] section.  However, once I'd done so and had a successful run of bin/buildout (no error messages), starting up the client would result in errors such as "ImportError: No module named ImplPython".  I initially tried to find unpinned versions with this command: "bin/buildout -Novvvvv |sed -ne 's/^Picked: //p' | sort | uniq" but that didn't identify zope.* eggs.  Ultimately, I found the necessary version numbers by looking at the contents of the lib/site-packages and buildout-cache directories to see which eggs were already there before I ran the "bad" buildout.
  • Other errors I got with various attempts I made, despite successful bin/buildout runs (no error messages), include "UnknownExtra: zope.security 3.7.2 has no such extra feature 'untrustedpython", "ImportError: cannot import name IDefaultViewName" (that was after modifying ImplC.py to raise an exception if it had a problem during an import statement), "ValueError: ('Missing distribution spec', '>=')" and "TypeError: sequence item 39: expected string, tuple found" (that was after trying to put a version number in the [plone] eggs value).

The solution

Here is the cleanest way to upgrade plone.portlet.static.  In the end, I chose to upgrade to version 2.0.1 rather than 1.2rc1.  1.2rc1 was my original choice, but in various attempts to do the upgrade I found that 1.2rc1 would try to pull in lots of zope.* eggs and eventually when I tried to upgrade to 2.0.1 it seemed not to pull in those zope.* eggs.

Zope fake eggs

First, you adjust buildout so it rebuilds the Zope version you are already using.

You do this by adding "additional-fake-eggs" to your [zope2] section so it should look like this:

[zope2]
recipe = plone.recipe.zope2install
url = ${plone:zope2-url}
additional-fake-eggs =
    Acquisition
    Zope2

Then rerun buildout.  It will compile some elements of Zope.  It should NOT download any new eggs!

If you skip this step, when you do the next step it will pull in a new version of Zope, which you don't want to have happen!

Override the Plone recipe

Now that you've got Zope rebuilt, you will upgrade plone.portlet.static.

With plone.recipe.plone, you can override the specified version of an egg by appending plone.portlet.static to your [plone] eggs:

eggs = plone.app.linkintegrity
    plone.portlet.static # upgrade from plone.portlet.static 1.1.5
then to your [versions] section as well:
plone.portlet.static = 2.0.1 # upgrade from plone.portlet.static 1.1.5

Then rerun buildout.  This should fetch only the new plone.portlet.static and should not fetch any other eggs. 

Verify

To verify that plone.portlet.static was upgraded correctly, go to the ZMI then to a Plone site (or create a Plone site), then to its Security tab.  You should see a new permission "Add static portlet".

Sample buildout.cfg

Here is a sample buildout.cfg that shows how to upgrade Plone 3.1.7 to use plone.portlet.static 2.0.1.

[versions]
plone.app.linkintegrity = 1.0.11
elementtree = 1.2.7-20070827-preview
feedparser = 4.1
plone.recipe.command = 1.0
plone.recipe.distros = 1.3
plone.recipe.plone = 3.1.7
plone.recipe.precompiler = 0.3
plone.recipe.unifiedinstaller = 0.6b6
plone.recipe.zope2install = 2.4
plone.recipe.zope2instance = 2.6
plone.recipe.zope2zeoserver = 1.0
python-openid = 2.2.1
setuptools = 0.6c9
zc.buildout = 1.1.1
zc.recipe.egg = 1.1.0
plone.recipe.atcontenttypes = 0.1
plone.portlet.static = 2.0.1 # upgrade from plone.portlet.static 1.1.5



[buildout] 
eggs-directory=/opt/Plone-3.1-01/buildout-cache/eggs
download-cache=/opt/Plone-3.1-01/buildout-cache/downloads
newest = false
parts =
    plone
    zope2
    productdistros
    zeoserver
    client1
    client2
    client3
    client4
    client5
    zopepy
    precompile
    chown
    unifiedinstaller
    flash
    atcontenttypes-client1
    atcontenttypes-client2
    atcontenttypes-client3
    atcontenttypes-client4
    atcontenttypes-client5

# Add additional egg download sources here. dist.plone.org contains archives
# of Plone packages.
find-links =
    http://www.uwosh.edu/ploneprojects/resources/basket/basket_view
    http://pypi.it.uwosh.edu/
    http://dist.plone.org
    http://download.zope.org/ppix/
    http://download.zope.org/distribution/
    http://effbot.org/downloads

# Add additional eggs here
# elementtree is required by Plone
eggs =
    elementtree
    FeedParser
    
# Reference any eggs you are developing here, one per line
# e.g.: develop = src/my.package
develop =

versions = versions


[plone]
recipe = plone.recipe.plone >=3.1.1, < 3.2dev
eggs = plone.app.linkintegrity
    plone.portlet.static # upgrade from plone.portlet.static 1.1.5

[zope2]
recipe = plone.recipe.zope2install
url = ${plone:zope2-url}
additional-fake-eggs =
    Acquisition
    Zope2

# Use this section to download additional old-style products.
# List any number of URLs for product tarballs under URLs (separate
# with whitespace, or break over several lines, with subsequent lines
# indented). If any archives contain several products inside a top-level
# directory, list the archive file name (i.e. the last part of the URL, 
# normally with a .tar.gz suffix or similar) under 'nested-packages'.
# If any archives extract to a product directory with a version suffix, list
# the archive name under 'version-suffix-packages'.
[productdistros]
recipe = plone.recipe.distros
urls =
nested-packages =
version-suffix-packages = 


[zeoserver]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:11100
effective-user = plone

[zeoserver-sites1]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:11101
file-storage = var/filestorage/Sites1.fs
storage-number = sites1
socket-name = /opt/Plone-3.1-01/zeocluster/var/zeo-sites1.zdsock
effective-user = plone

[zeoserver-sites2]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:11102
file-storage = var/filestorage/Sites2.fs
storage-number = sites2
socket-name = /opt/Plone-3.1-01/zeocluster/var/zeo-sites2.zdsock
effective-user = plone

[zeoserver-sites3]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:11103
file-storage = var/filestorage/Sites3.fs
storage-number = sites3
socket-name = /opt/Plone-3.1-01/zeocluster/var/zeo-sites3.zdsock
effective-user = plone


[client1]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
# The line below sets only the initial password. It will not change an
# existing password.
user = xxx:xxx
http-address = 11080
effective-user = plone
#debug-mode = on
#verbose-security = on

# If you want Zope to know about any additional eggs, list them here.
# This should include any development eggs you listed in develop-eggs above,
# e.g. eggs = ${buildout:eggs} ${plone:eggs} my.package
eggs =
    ${plone:eggs}
    ${buildout:eggs}

# If you want to register ZCML slugs for any packages, list them here.
# e.g. zcml = my.package my.other.package
zcml = uwosh.core
    collective.portlet.tal
    uwosh.flash
    uwosh.initiatives
    Products.EasyAsPiIE
    uwosh.thememain
    uwosh.themebase
    uwosh.themecollege
    uwosh.default
    uwosh.requirements
    uwosh.simpleemergency
    uwosh.colsagenda
    collective.plonetruegallery
    uwosh.timeslot
    webcouturier.dropdownmenu
    uwosh.groupmailer
    uwosh.customnav
    collective.easyslider
    uwosh.linkable_image
    collective.uploadify
    collective.recaptcha

products =
    ${buildout:directory}/products
    ${productdistros:location}
    ${plone:products}
    /UWO/Plone-3.1-01/Products


zope-conf-additional =
 <zodb_db sites1>
    <zeoclient>
      server ${zeoserver-sites1:zeo-address}
      storage sites1
      name sites1
    </zeoclient>
      mount-point /sites1
 </zodb_db>
 <zodb_db sites2>
    <zeoclient>
      server ${zeoserver-sites2:zeo-address}
      storage sites2
      name sites2
    </zeoclient>
      mount-point /sites2
 </zodb_db>
 <zodb_db sites3>
    <zeoclient>
      server ${zeoserver-sites3:zeo-address}
      storage sites3
      name sites3
    </zeoclient>
      mount-point /sites3
 </zodb_db>

 <environment>
    DISABLE_PTS 1
 </environment>

[client2]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
user = ${client1:user}
http-address = 11081
effective-user = plone
#debug-mode = on
#verbose-security = on
eggs = ${client1:eggs}
zcml = ${client1:zcml}
products = ${client1:products}
zope-conf-additional = ${client1:zope-conf-additional}

[client3]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
user = ${client1:user}
http-address = 11082
effective-user = plone
debug-mode = on
#verbose-security = on
eggs = ${client1:eggs}
zcml = ${client1:zcml}
products = ${client1:products}
zope-conf-additional = ${client1:zope-conf-additional}

[client4]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
user = ${client1:user}
http-address = 11083
effective-user = plone
#debug-mode = on
#verbose-security = on
eggs = ${client1:eggs}
zcml = ${client1:zcml}
products = ${client1:products}
zope-conf-additional = ${client1:zope-conf-additional}

[client5]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
user = ${client1:user}
http-address = 11084
effective-user = plone
#debug-mode = on
#verbose-security = on
eggs = ${client1:eggs}
zcml = ${client1:zcml}
products = ${client1:products}
zope-conf-additional = ${client1:zope-conf-additional}



[zopepy]
recipe = zc.recipe.egg
eggs = ${client1:eggs}
interpreter = zopepy
extra-paths = ${zope2:location}/lib/python
scripts = zopepy


[precompile]
recipe = plone.recipe.precompiler


[chown]
# This recipe is used to set permissions -- and ownership for root mode installs
recipe = plone.recipe.command
command =
    chmod 600 .installed.cfg
    touch ${buildout:directory}/var/log/zeoserver.log
    touch ${buildout:directory}/var/log/zeoserver-sites1.log
    touch ${buildout:directory}/var/log/zeoserver-sites2.log
    touch ${buildout:directory}/var/log/zeoserver-sites3.log
    find ${buildout:directory} -type d -name var -exec chown -R ${client1:effective-user} \{\} \;
    find ${buildout:directory} -type d -name LC_MESSAGES -exec chown -R ${client1:effective-user} \{\} \;
    find ${buildout:directory} -name runzope -exec chown ${client1:effective-user} \{\} \;
update-command = ${chown:command}


[unifiedinstaller]
recipe = plone.recipe.unifiedinstaller
user = ${client1:user}
primary-port = ${client1:http-address}
sudo-command = sudo

[flash]
recipe = uwosh.recipe.flash
server_address = rtmp://flash.idea.uwosh.edu/vod
ftp_address = flash.idea.uwosh.edu
ftp_user = xxx
ftp_password = xxx
ftp_media_directory = /flash/adobe/fms/applications/vod/media

# This places limits on image and file sizes
#
[atcontenttypes-client1]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client1:location}
max-file-size          = ATImage:500kb
                         ATFile:30mb
                         ATNewsItem:500kb
max-image-dimension    = ATNewsItem:640,400
                         ATImage:1024,1024

[atcontenttypes-client2]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client2:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

[atcontenttypes-client3]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client3:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

[atcontenttypes-client4]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client4:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

[atcontenttypes-client5]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client5:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}
 

 

Navigation