[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/translation - __init__.py:1.3 configure.zcml:1.8 exportimport.py:1.4 synchronize.py:1.4 translate.py:1.4 basetranslationserviceview.py:NONE

Stephan Richter srichter@cosmos.phy.tufts.edu
Fri, 18 Jul 2003 12:40:19 -0400


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

Modified Files:
	__init__.py configure.zcml exportimport.py synchronize.py 
	translate.py 
Removed Files:
	basetranslationserviceview.py 
Log Message:
Simplified View code of translation service; made configuration use more 
modern features. 


=== Zope3/src/zope/app/browser/services/translation/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/services/translation/__init__.py:1.2	Wed Dec 25 09:12:38 2002
+++ Zope3/src/zope/app/browser/services/translation/__init__.py	Fri Jul 18 12:40:12 2003
@@ -1,2 +1,30 @@
+##############################################################################
 #
-# This file is necessary to make this directory a package.
+# 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 Service Views
+
+$Id$
+"""
+from zope.i18n.interfaces import ITranslationService
+
+class BaseView(object):
+
+    __used_for__ = ITranslationService
+
+    def getAllLanguages(self):
+        """Get all available languages from the Translation Service."""
+        return self.context.getAllLanguages()
+
+    def getAllDomains(self):
+        """Get all available domains from the Translation Service."""
+        return self.context.getAllDomains()


=== Zope3/src/zope/app/browser/services/translation/configure.zcml 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/services/translation/configure.zcml:1.7	Tue Mar 25 13:31:49 2003
+++ Zope3/src/zope/app/browser/services/translation/configure.zcml	Fri Jul 18 12:40:12 2003
@@ -7,68 +7,108 @@
     for="zope.i18n.interfaces.ITranslationService"
     class="zope.app.browser.services.translation.translate.Translate">
 
-  <browser:page name="index.html" attribute="index" />
-  <browser:page name="translateMessage.html" attribute="translateMessage" />
+  <browser:page 
+      name="translate.html" 
+      template="./translate.pt" 
+      menu="zmi_views" title="Translate" />
+
+  <browser:page 
+      name="translateMessage.html" 
+      template="./translatemessage.pt" />
   
-  <browser:page name="editMessages.html" attribute="editMessages" />
-  <browser:page name="editMessage.html" attribute="editMessage" />
+  <browser:page 
+      name="editMessages.html" 
+      attribute="editMessages" />
+
+  <browser:page 
+      name="deleteMessages.html" 
+      attribute="deleteMessages" />
   
-  <browser:page name="deleteMessages.html" attribute="deleteMessages" />
-  
-  <browser:page name="addLanguage.html" attribute="addLanguage" />
-  <browser:page name="addDomain.html" attribute="addDomain" />
-  
-  <browser:page name="changeEditLanguages.html" 
+  <browser:page 
+      name="addLanguage.html" 
+      attribute="addLanguage" />
+
+  <browser:page 
+      name="changeEditLanguages.html" 
       attribute="changeEditLanguages" />
-  <browser:page name="changeEditDomains.html" 
-      attribute="changeEditDomains" />
-  <browser:page name="changeFilter.html" 
-                attribute="changeFilter" />
+
+  <browser:page 
+      name="deleteLanguages.html" 
+      attribute="deleteLanguages" />
+
+  <browser:page 
+      name="addDomain.html" 
+      attribute="addDomain" />
   
-  <browser:page name="deleteLanguages.html" attribute="deleteLanguages" />
-  <browser:page name="deleteDomains.html" attribute="deleteDomains" />
+  <browser:page 
+      name="changeEditDomains.html" 
+      attribute="changeEditDomains" />
 
+  <browser:page 
+      name="deleteDomains.html" 
+      attribute="deleteDomains" />
+
+  <browser:page 
+      name="changeFilter.html" 
+      attribute="changeFilter" />
+  
 </browser:pages>
 
-<browser:pages 
-   permission="zope.ManageServices" 
-   for="zope.i18n.interfaces.ITranslationService"
-   class="zope.app.browser.services.translation.exportimport.ExportImport">
-
-   <browser:page name="exportImportForm.html" attribute="exportImportForm" />
 
-   <browser:page name="export.html" attribute="exportMessages" />
-   <browser:page name="import.html" attribute="importMessages" />
+<browser:pages 
+    permission="zope.ManageServices" 
+    for="zope.i18n.interfaces.ITranslationService"
+    class="zope.app.browser.services.translation.exportimport.ExportImport">
+  
+  <browser:page 
+      name="exportImportForm.html" 
+      template="./exportimport.pt"
+      menu="zmi_views" title="Import/Export" />
+  
+  <browser:page 
+      name="export.html" 
+      attribute="exportMessages" />
+
+  <browser:page 
+      name="import.html" 
+      attribute="importMessages" />
 
 </browser:pages>
 
+
 <browser:pages
-   permission="zope.ManageServices" 
-   for="zope.i18n.interfaces.ITranslationService"
-   class="zope.app.browser.services.translation.synchronize.Synchronize">
-
-   <browser:page name="synchronizeForm.html" attribute="synchronizeForm" />
-   <browser:page name="synchronize.html" attribute="synchronize" />
-   <browser:page name="synchronizeMessages.html" 
-                 attribute="synchronizeMessages" />
-   <browser:page name="saveSettings.html" attribute="saveSettings" />
+    permission="zope.ManageServices" 
+    for="zope.i18n.interfaces.ITranslationService"
+    class="zope.app.browser.services.translation.synchronize.Synchronize">
+  
+  <browser:page 
+      name="synchronizeForm.html" 
+      template="./synchronize.pt"
+      menu="zmi_views" title="Synchronize" />
+  
+  <browser:page 
+      name="synchronize.html" 
+      attribute="synchronize" />
+  
+  <browser:page 
+      name="synchronizeMessages.html" 
+      attribute="synchronizeMessages" />
+  
+  <browser:page 
+      name="saveSettings.html" 
+      attribute="saveSettings" />
 
 </browser:pages>
 
-
-<browser:menuItems menu="zmi_views" 
-    for="zope.i18n.interfaces.ITranslationService">
-  <browser:menuItem title="Translate" action="@@index.html"/>
-  <browser:menuItem title="Import/Export" action="@@exportImportForm.html"/>
-  <browser:menuItem title="Synchronize" action="@@synchronizeForm.html"/>
-</browser:menuItems>
+<browser:defaultView
+    for="zope.i18n.interfaces.ITranslationService"
+    name="translate.html"/>
 
 <browser:menuItem
      menu="add_service"
      for="zope.app.interfaces.container.IAdding"
      action="TranslationService"
      title="Translation Service"
-     description="A Persistent Translation Service for TTW development"
-     />
+     description="A Persistent Translation Service for TTW development" />
 
 </zopeConfigure>


=== Zope3/src/zope/app/browser/services/translation/exportimport.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/translation/exportimport.py:1.3	Mon Dec 30 21:51:55 2002
+++ Zope3/src/zope/app/browser/services/translation/exportimport.py	Fri Jul 18 12:40:12 2003
@@ -18,18 +18,14 @@
 from zope.component import getAdapter
 from zope.i18n.interfaces import IMessageExportFilter, IMessageImportFilter
 
-from zope.app.browser.services.translation.basetranslationserviceview \
-     import BaseTranslationServiceView
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.browser.services.translation import BaseView
 
 
-class ExportImport(BaseTranslationServiceView):
-
-    exportImportForm = ViewPageTemplateFile('exportimport.pt')
+class ExportImport(BaseView):
 
     def exportMessages(self, domains, languages):
         self.request.response.setHeader('content-type',
-                                             'application/x-gettext')
+                                        'application/x-gettext')
         filter = getAdapter(self.context, IMessageExportFilter)
         return filter.exportMessages(domains, languages)
 


=== Zope3/src/zope/app/browser/services/translation/synchronize.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/translation/synchronize.py:1.3	Sun Mar 23 17:35:37 2003
+++ Zope3/src/zope/app/browser/services/translation/synchronize.py	Fri Jul 18 12:40:12 2003
@@ -21,14 +21,10 @@
 
 from base64 import encodestring
 
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.app.browser.services.translation.basetranslationserviceview \
-     import BaseTranslationServiceView
+from zope.app.browser.services.translation import BaseView
 
 
-class Synchronize(BaseTranslationServiceView):
-
-    synchronizeForm = ViewPageTemplateFile('synchronize.pt')
+class Synchronize(BaseView):
 
     messageStatus = ['Up to Date', 'New Remote', 'Out of Date', 'Newer Local',
                      'Does not exist']


=== Zope3/src/zope/app/browser/services/translation/translate.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/translation/translate.py:1.3	Thu Apr 17 16:05:11 2003
+++ Zope3/src/zope/app/browser/services/translation/translate.py	Fri Jul 18 12:40:12 2003
@@ -15,15 +15,9 @@
 
 $Id$
 """
-from zope.app.browser.services.translation.basetranslationserviceview \
-     import BaseTranslationServiceView
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.browser.services.translation import BaseView
 
-
-class Translate(BaseTranslationServiceView):
-
-    index = ViewPageTemplateFile('translate.pt')
-    translateMessage = ViewPageTemplateFile('translatemessage.pt')
+class Translate(BaseView):
 
     def getMessages(self):
         """Get messages based on the domain selection"""

=== Removed File Zope3/src/zope/app/browser/services/translation/basetranslationserviceview.py ===