/usr/share/pyshared/zope/app/applicationcontrol/browser/translationdomaincontrol.py is in python-zope.app.applicationcontrol 3.5.10-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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: translationdomaincontrol.py 121717 2011-05-18 19:23:30Z menesis $
"""
__docformat__ = 'restructuredtext'
import zope.component
from zope.i18n.interfaces import ITranslationDomain
from zope.app.applicationcontrol.i18n import ZopeMessageFactory as _
class TranslationDomainControlView(object):
def getCatalogsInfo(self):
info = []
for name, domain in zope.component.getUtilitiesFor(ITranslationDomain):
if not hasattr(domain, 'getCatalogsInfo'):
continue
lang_info = []
info.append({'domain': name, 'languagesInfo': lang_info})
for language, fileNames in domain.getCatalogsInfo().items():
lang_info.append({'language': language,
'fileNames': fileNames})
return info
def reloadCatalogs(self):
"""Do the reloading !"""
status = ''
if 'RELOAD' in self.request:
language = self.request.get('language')
domain = self.request.get('domain')
domain = zope.component.getUtility(ITranslationDomain, domain)
for lang, fileNames in domain.getCatalogsInfo().items():
if lang == language:
domain.reloadCatalogs(fileNames)
status = _('Message Catalog for ${language} language'
' in ${domain} domain successfully reloaded.',
mapping = {u'language': language,
u'domain': domain.domain})
return status
|