[Zope3-checkins] CVS: Zope3/src/zope/app/browser/applicationcontrol
- globaltranslationservicecontrol.py:1.1
globaltranslationservicecontrol.pt:1.1 configure.zcml:1.8
Godefroid Chapelle
gotcha at swing.be
Tue Aug 12 12:52:13 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/applicationcontrol
In directory cvs.zope.org:/tmp/cvs-serv15359
Modified Files:
configure.zcml
Added Files:
globaltranslationservicecontrol.py
globaltranslationservicecontrol.pt
Log Message:
added view in process manager to allow
to reload message ids catalogs
without restarting server
=== Added File Zope3/src/zope/app/browser/applicationcontrol/globaltranslationservicecontrol.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" Server Control View
$Id: globaltranslationservicecontrol.py,v 1.1 2003/08/12 15:52:08 gotcha Exp $
"""
from zodb.storage.file.errors import FileStorageError
from zope.app.interfaces.applicationcontrol import IGlobalTSControl
from zope.component import getAdapter
from zope.app.i18n import ZopeMessageIDFactory as _
class GlobalTSControlView:
def getCatalogsInfo(self):
globaltscontrol = getAdapter(self.context, IGlobalTSControl)
catalogsInfo = globaltscontrol.getCatalogsInfo()
languages_domains = catalogsInfo.keys()
domains_languages = []
for language, domain in languages_domains:
domains_languages.append((domain, language))
domains_languages.sort()
catalogsInfoMaps = []
for domain, language in domains_languages:
fileNames = list(catalogsInfo[(language, domain)])
catalogsInfoMaps.append({'language':language, 'domain':domain,
'fileNames':fileNames})
return catalogsInfoMaps
def reloadCatalogs(self):
"""Do the reloading !"""
status = ''
if 'RELOAD' in self.request:
language = self.request.get('language')
domain = self.request.get('domain')
globaltscontrol = getAdapter(self.context, IGlobalTSControl)
catalogs = globaltscontrol.getCatalogsInfo()
catalogNames = catalogs[(language,domain)]
globaltscontrol.reloadCatalogs(catalogNames)
status = _('message catalog successfully reloaded.')
return status
=== Added File Zope3/src/zope/app/browser/applicationcontrol/globaltranslationservicecontrol.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title i18n:translate="">ZGlobal Transaction Service Controller</title>
</head>
<body>
<div metal:fill-slot="body">
<p tal:define="status view/reloadCatalogs"
tal:condition="status"
tal:content="status" />
<table>
<tr>
<th i18n:translate="">Domain</th>
<th i18n:translate="">Language</th>
<th i18n:translate="">Files</th>
<th> </th>
</tr>
<tr tal:repeat="catalogInfo view/getCatalogsInfo">
<td tal:content="catalogInfo/domain"></td>
<td tal:content="catalogInfo/language"></td>
<td><div tal:repeat="fileName catalogInfo/fileNames" tal:content="fileName"></div></td>
<td><a tal:attributes="href string:?RELOAD=&domain=${catalogInfo/domain}&language=${catalogInfo/language}"
i18n:translate="">Reload</a></td>
</tr>
</table>
</div>
</body>
</html>
=== Zope3/src/zope/app/browser/applicationcontrol/configure.zcml 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/applicationcontrol/configure.zcml:1.7 Wed Aug 6 10:41:20 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/configure.zcml Tue Aug 12 11:52:08 2003
@@ -28,4 +28,12 @@
permission="zope.ManageApplication"
menu="zmi_views" title="ZODB Control"/>
-</configure>
\ No newline at end of file
+ <page
+ for="zope.app.interfaces.applicationcontrol.IApplicationControl"
+ name="GlobalTSControl.html"
+ template="globaltranslationservicecontrol.pt"
+ class="zope.app.browser.applicationcontrol.globaltranslationservicecontrol.GlobalTSControlView"
+ permission="zope.ManageApplication"
+ menu="zmi_views" title="Global Translation Service Control"/>
+
+</configure>
More information about the Zope3-Checkins
mailing list