[Zope3-checkins] CVS: Zope3/src/zope/app/applicationcontrol/browser - globaltranslationservicecontrol.py:1.2 runtimeinfo.py:1.2 zodbcontrol.py:1.2

Jim Fulton jim at zope.com
Sat Mar 6 11:50:43 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/applicationcontrol/browser
In directory cvs.zope.org:/tmp/cvs-serv11249/src/zope/app/applicationcontrol/browser

Modified Files:
	globaltranslationservicecontrol.py runtimeinfo.py 
	zodbcontrol.py 
Log Message:
Converted most getAdapter calls to use interface calls instead.


=== Zope3/src/zope/app/applicationcontrol/browser/globaltranslationservicecontrol.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/applicationcontrol/browser/globaltranslationservicecontrol.py:1.1	Mon Mar  1 08:43:25 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/globaltranslationservicecontrol.py	Sat Mar  6 11:50:12 2004
@@ -17,14 +17,13 @@
 """
 
 from zope.app.applicationcontrol.interfaces import IGlobalTSControl
-from zope.component import getAdapter
 
 from zope.app.i18n import ZopeMessageIDFactory as _
 
 class GlobalTSControlView:
 
     def getCatalogsInfo(self):
-        globaltscontrol = getAdapter(self.context, IGlobalTSControl)
+        globaltscontrol = IGlobalTSControl(self.context)
         catalogsInfo = globaltscontrol.getCatalogsInfo()
         languages_domains = catalogsInfo.keys()
         domains_languages = []
@@ -46,7 +45,7 @@
         if 'RELOAD' in self.request:
             language = self.request.get('language')
             domain = self.request.get('domain')
-            globaltscontrol = getAdapter(self.context, IGlobalTSControl)
+            globaltscontrol = IGlobalTSControl(self.context)
             catalogs = globaltscontrol.getCatalogsInfo()
             catalogNames = catalogs[(language,domain)]
             globaltscontrol.reloadCatalogs(catalogNames)


=== Zope3/src/zope/app/applicationcontrol/browser/runtimeinfo.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/applicationcontrol/browser/runtimeinfo.py:1.1	Mon Mar  1 08:43:25 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/runtimeinfo.py	Sat Mar  6 11:50:12 2004
@@ -16,7 +16,6 @@
 $Id$
 """
 from zope.app.applicationcontrol.interfaces import IRuntimeInfo
-from zope.component import getAdapter
 from zope.component import ComponentLookupError
 
 from zope.app.i18n import ZopeMessageIDFactory as _
@@ -27,7 +26,7 @@
         formatted = {}  # will contain formatted runtime information
 
         try:
-            runtime_info = getAdapter(self.context, IRuntimeInfo)
+            runtime_info = IRuntimeInfo(self.context)
             formatted['ZopeVersion'] = runtime_info.getZopeVersion()
             formatted['PythonVersion'] = runtime_info.getPythonVersion()
             formatted['PythonPath'] = runtime_info.getPythonPath()
@@ -57,7 +56,7 @@
 
             formatted['Uptime'] = uptime
 
-        except ComponentLookupError:
+        except TypeError:
             # We avoid having errors in the ApplicationController,
             # because all those things need to stay accessible.
             formatted['ZopeVersion'] = "N/A"


=== Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.py:1.1	Mon Mar  1 08:43:25 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.py	Sat Mar  6 11:50:12 2004
@@ -17,7 +17,6 @@
 """
 from ZODB.FileStorage.FileStorage import FileStorageError
 from zope.app.applicationcontrol.interfaces import IZODBControl
-from zope.component import getAdapter
 
 from zope.app.i18n import ZopeMessageIDFactory as _
 
@@ -25,7 +24,7 @@
 
     def getDatabaseSize(self):
         """Get the database size in a human readable format."""
-        zodbcontrol = getAdapter(self.context, IZODBControl)
+        zodbcontrol = IZODBControl(self.context)
         size = zodbcontrol.getDatabaseSize(self.request.publication.db)
         if size > 1024**2:
             size_str = _("${size} MB")
@@ -45,7 +44,7 @@
         status = ''
         
         if 'PACK' in self.request:
-            zodbcontrol = getAdapter(self.context, IZODBControl)
+            zodbcontrol = IZODBControl(self.context)
             try:
                 zodbcontrol.pack(self.request.publication.db,
                                  int(self.request.get('days', 0)))




More information about the Zope3-Checkins mailing list