[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/translation - translate.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Tue, 24 Dec 2002 02:33:59 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/services/translation
In directory cvs.zope.org:/tmp/cvs-serv24265
Modified Files:
Tag: NameGeddon-branch
translate.py
Log Message:
- fix & clean up imports
- general cleanup, normalize whitespace
=== Zope3/src/zope/app/browser/services/translation/translate.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/browser/services/translation/translate.py:1.1.2.1 Mon Dec 23 14:31:15 2002
+++ Zope3/src/zope/app/browser/services/translation/translate.py Tue Dec 24 02:33:59 2002
@@ -2,29 +2,29 @@
#
# 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 GUI
$Id$
"""
-from Zope.App.PageTemplate import ViewPageTemplateFile
+from zope.app.browser.services.translation.basetranslationserviceview \
+ import BaseTranslationServiceView
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.app.browser.services.translation.basetranslationserviceview import BaseTranslationServiceView
class Translate(BaseTranslationServiceView):
-
+
index = ViewPageTemplateFile('translate.pt')
translateMessage = ViewPageTemplateFile('translateMessage.pt')
-
def getMessages(self):
"""Get messages based on the domain selection"""
filter = self.request.get('filter', '%')
@@ -38,10 +38,9 @@
def getTranslation(self, domain, msgid, target_lang):
- """ """
return self.context.translate(domain, msgid,
target_language=target_lang)
-
+
def getEditLanguages(self):
'''get the languages that are selected for editing'''
@@ -56,7 +55,6 @@
def editMessage(self):
- """ """
domain = self.request['msg_domain']
msg_id = self.request['msg_id']
for language in self.getEditLanguages():
@@ -65,10 +63,9 @@
target_language=language):
self.context.updateMessage(domain, msg_id, msg, language)
return self.request.response.redirect(self.request.URL[-1])
-
+
def editMessages(self):
- """ """
# Handle new Messages
for count in range(5):
msg_id = self.request.get('new-msg_id-%i' %count, '')
@@ -91,12 +88,11 @@
if msg != self.context.translate(domain, msg_id,
target_language=language):
self.context.updateMessage(domain, msg_id, msg, language)
-
+
return self.request.response.redirect(self.request.URL[-1])
def deleteMessages(self, message_ids):
- """ """
for id in message_ids:
domain = self.request.form['edit-domain-%s' %id]
msgid = self.request.form['edit-msg_id-%s' %id]
@@ -110,48 +106,39 @@
def addLanguage(self, language):
- """ """
self.context.addLanguage(language)
return self.request.response.redirect(self.request.URL[-1])
def addDomain(self, domain):
- """ """
self.context.addDomain(domain)
return self.request.response.redirect(self.request.URL[-1])
def changeEditLanguages(self, languages=[]):
- """ """
self.request.response.setCookie('edit_languages',
- ','.join(languages))
+ ','.join(languages))
return self.request.response.redirect(self.request.URL[-1])
def changeEditDomains(self, domains=[]):
- """ """
self.request.response.setCookie('edit_domains', ','.join(domains))
return self.request.response.redirect(self.request.URL[-1])
def changeFilter(self):
- """ """
filter = self.request.get('filter', '%')
self.request.response.setCookie('filter', filter)
return self.request.response.redirect(self.request.URL[-1])
def deleteLanguages(self, languages):
- """ """
for language in languages:
self.context.deleteLanguage(language)
return self.request.response.redirect(self.request.URL[-1])
def deleteDomains(self, domains):
- """ """
for domain in domains:
self.context.deleteDomain(domain)
return self.request.response.redirect(self.request.URL[-1])
-
-