[Zope3-checkins] CVS: Zope3/src/zope/app/services/translation/xmlrpc - __init__.py:1.1.2.1 configure.zcml:1.1.2.1 methods.py:1.1.2.1

Jim Fulton jim@zope.com
Mon, 23 Dec 2002 14:32:31 -0500


Update of /cvs-repository/Zope3/src/zope/app/services/translation/xmlrpc
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/services/translation/xmlrpc

Added Files:
      Tag: NameGeddon-branch
	__init__.py configure.zcml methods.py 
Log Message:
Initial renaming before debugging

=== Added File Zope3/src/zope/app/services/translation/xmlrpc/__init__.py ===
#
# This file is necessary to make this directory a package.


=== Added File Zope3/src/zope/app/services/translation/xmlrpc/configure.zcml ===
<zopeConfigure
   xmlns='http://namespaces.zope.org/zope'
   xmlns:xmlrpc='http://namespaces.zope.org/xmlrpc'
>

  <!-- Translation Service View Directives -->

  <xmlrpc:view
      name="methods"
      for="zope.interfaces.i18n.ITranslationService"
      permission="Zope.ManageContent" 
      allowed_methods="getAllLanguages getAllDomains"
      factory="zope.app.services.translation.xmlrpc.methods.Methods" />
      
</zopeConfigure>


=== Added File Zope3/src/zope/app/services/translation/xmlrpc/methods.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.
# 
##############################################################################
"""

$Id: methods.py,v 1.1.2.1 2002/12/23 19:32:30 jim Exp $
"""
from zope.proxy.introspection import removeAllProxies

from zope.publisher.xmlrpc import XMLRPCView
from Zope.App.PageTemplate import ViewPageTemplateFile


class Methods(XMLRPCView):

    __implements__ = XMLRPCView.__implements__
        
    def getAllDomains(self):
        return self.context.getAllDomains()


    def getAllLanguages(self):
        return self.context.getAllLanguages()


    def getMessagesFor(self, domains, languages):
        messages = []
        for domain in domains:
            for msg in self.context.getMessagesOfDomain(domain):
                if msg['language'] in languages:
                    messages.append(removeAllProxies(msg))

        return messages