Back to index

plone3  3.1.7
prefs_reinstallProducts.py
Go to the documentation of this file.
00001 ## Script (Python) "prefs_reinstallProducts"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=
00008 ##title=prefs_reinstallProducts
00009 ##
00010 
00011 from Products.CMFCore.utils import getToolByName
00012 from Products.CMFPlone import PloneMessageFactory as _
00013 
00014 req = context.REQUEST
00015 
00016 qi = getToolByName(context, 'portal_quickinstaller')
00017 putil = getToolByName(context, 'plone_utils')
00018 
00019 product = req.get('prefs_reinstallProducts', None)
00020 if product:
00021     qi.reinstallProducts(products=[product])
00022     msg = _(u'Reinstalled ${product}', mapping={'product':product})
00023     putil.addPortalMessage(msg)
00024 
00025 purl = getToolByName(context, 'portal_url')()
00026 req.response.redirect(purl + '/prefs_install_products_form')
00027 
00028 return 'Redirecting ...'