[Zope3-checkins] CVS: Zope3/src/zope/app/i18n/xmlrpc - __init__.py:1.1 configure.zcml:1.1 methods.py:1.1

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 8 18:34:50 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/i18n/xmlrpc
In directory cvs.zope.org:/tmp/cvs-serv4810/src/zope/app/i18n/xmlrpc

Added Files:
	__init__.py configure.zcml methods.py 
Log Message:


Moved local translation domain implementation to zope.app.i18n.




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


=== Added File Zope3/src/zope/app/i18n/xmlrpc/configure.zcml ===
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
    >

  <!-- Translation Domain View Directives -->

  <xmlrpc:view
      name="methods"
      for="zope.i18n.interfaces.ITranslationDomain"
      permission="zope.ManageContent" 
      allowed_attributes="getAllLanguages getMessagesFor"
      class=".methods.Methods" />
      
  <xmlrpc:defaultView
      name="methods"
      for="zope.i18n.interfaces.ITranslationDomain" />
     

</configure>


=== Added File Zope3/src/zope/app/i18n/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.
#
##############################################################################
"""Translation Domain XML-RPC Methods 

$Id: methods.py,v 1.1 2004/03/08 23:34:49 srichter Exp $
"""
from zope.proxy import removeAllProxies
from zope.publisher.xmlrpc import XMLRPCView


class Methods(XMLRPCView):

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

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

        return messages




More information about the Zope3-Checkins mailing list