[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/translation - synchronize.py:1.1.2.2

Fred L. Drake, Jr. fred@zope.com
Tue, 24 Dec 2002 02:31:45 -0500


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

Modified Files:
      Tag: NameGeddon-branch
	synchronize.py 
Log Message:
- fix & clean up imports
- general cleanup, normalize whitespace


=== Zope3/src/zope/app/browser/services/translation/synchronize.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/browser/services/translation/synchronize.py:1.1.2.1	Mon Dec 23 14:31:15 2002
+++ Zope3/src/zope/app/browser/services/translation/synchronize.py	Tue Dec 24 02:31:45 2002
@@ -2,24 +2,28 @@
 #
 # 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.
-# 
+#
 ##############################################################################
 """Synchronize with Foreign Translation Services
 
 $Id$
 """
-import xmlrpclib, httplib, urllib
+import httplib
+import urllib
+import xmlrpclib
+
 from base64 import encodestring
 
-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 Synchronize(BaseTranslationServiceView):
@@ -94,10 +98,10 @@
                 return self._connect()
             except:
                 return 0
-            
+
 
     def getAllDomains(self):
-        connected = self._isConnected() 
+        connected = self._isConnected()
         if not connected: connected = self._connect()
 
         if connected:
@@ -108,7 +112,7 @@
 
 
     def getAllLanguages(self):
-        connected = self._isConnected() 
+        connected = self._isConnected()
         if not connected: connected = self._connect()
 
         if connected:
@@ -116,13 +120,13 @@
         else:
             return []
 
-            
+
 
     def queryMessages(self):
-        connected = self._isConnected() 
+        connected = self._isConnected()
         if not connected: connected = self._connect()
 
-        if connected:            
+        if connected:
             fmsgs = self._connection.getMessagesFor(self.sync_domains,
                                                     self.sync_languages)
         else:
@@ -149,7 +153,7 @@
         if verbose:
             return self.messageStatus[state]
         return state
-            
+
 
     def saveSettings(self):
         self.sync_domains = self.request.form.get('sync_domains', [])
@@ -168,7 +172,7 @@
         return self.request.response.redirect(self.request.URL[-1]+
                                                    '/@@synchronizeForm.html')
 
-        
+
     def synchronize(self):
         mapping = self.queryMessages()
         self.context.synchronize(mapping)
@@ -204,7 +208,7 @@
 
     def request(self, host, handler, request_body, verbose=0):
         # issue XML-RPC request
-        
+
         self.verbose = verbose
 
         h = httplib.HTTP(host)
@@ -220,9 +224,9 @@
 
         # basic auth
         if self.username is not None and self.password is not None:
-            h.putheader("AUTHORIZATION", "Basic %s" % 
+            h.putheader("AUTHORIZATION", "Basic %s" %
                         encodestring("%s:%s" % (self.username, self.password)
-                                      ).replace("\012", ""))
+                                     ).replace("\012", ""))
         h.endheaders()
 
         if request_body:
@@ -231,11 +235,7 @@
         errcode, errmsg, headers = h.getreply()
 
         if errcode != 200:
-            raise xmlrpclib.ProtocolError(
-                host + handler,
-                errcode, errmsg,
-                headers
-                )
-
-        return self.parse_response(h.getfile()) 
+            raise xmlrpclib.ProtocolError(host + handler,
+                                          errcode, errmsg, headers)
 
+        return self.parse_response(h.getfile())