Commit eefd91f5 authored by Aurel's avatar Aurel

add a tab which allows to reload a Product on a running instance


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38134 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1d5338e7
......@@ -43,6 +43,7 @@ from Acquisition import Implicit
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from App.config import getConfiguration
from App import RefreshFuncs
from Shared.DC.ZRDB.TM import TM
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
......@@ -328,6 +329,9 @@ if allowClassTool():
,{ 'label' : 'Tests'
, 'action' : 'manage_viewTestList'
}
,{ 'label' : 'Reload Product'
, 'action' : 'manage_viewProductReload'
}
,{ 'label' : 'Product Generation'
, 'action' : 'manage_viewProductGeneration'
}
......@@ -374,6 +378,9 @@ if allowClassTool():
security.declareProtected( Permissions.ManagePortal, 'manage_viewProductGeneration' )
manage_viewProductGeneration = DTMLFile( 'viewProductGeneration', _dtmldir )
security.declareProtected( Permissions.ManagePortal, 'manage_viewProductReload' )
manage_viewProductReload = DTMLFile( 'viewProductReload', _dtmldir )
def _clearCache(self):
"""
Clears the cache of all databases
......@@ -1192,6 +1199,26 @@ def initialize( context ):
path = os.path.join(getConfiguration().instancehome, 'tests')
return runLiveTest(test_list, run_only=run_only, debug=debug, path=path)
def getProductList(self):
""" List all products """
return self.Control_Panel.Products.objectIds()
def reloadProduct(self, product_id, REQUEST=None):
""" Reload a given product """
product = self.Control_Panel.Products[product_id]
if product._readRefreshTxt() is None:
raise Unauthorized, 'refresh.txt not found'
message = None
if RefreshFuncs.performFullRefresh(product._p_jar, product.id):
from ZODB import Connection
Connection.resetCaches() # Clears cache in future connections.
message = 'Product refreshed.'
else:
message = 'An exception occurred. Check your log'
if REQUEST is not None:
REQUEST.RESPONSE.redirect('%s/manage_viewProductReload?manage_tabs_message=%s' % (self.absolute_url(), message))
else:
class ClassTool(BaseTool, ClassToolMixIn):
......
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<div class="std-text"><p><strong>Reload Products</strong></p></div>
<table width="100%">
<tr class="list-header">
<th>
Product
</th>
<th>
Action
</th>
<dtml-in getProductList>
<dtml-if sequence-odd>
<tr class="row-normal">
<dtml-else>
<tr class="row-hilite">
</dtml-if>
<td>
<div class="list-item"><dtml-var sequence-item></div>
</td>
<td>
<div class="list-item"><a href="reloadProduct?product_id=<dtml-var sequence-item>">reload</a></div>
</td>
</tr>
</dtml-in>
</table>
<hr/>
<dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment