[Zope3-checkins] CVS: Zope3/src/zope/app/browser/applicationcontrol - configure.zcml:1.7 runtimeinfo.pt:1.4 runtimeinfo.py:1.5 server-control.pt:1.4 zodbcontrol.pt:1.2 zodbcontrol.py:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 6 11:42:27 EDT 2003


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

Modified Files:
	configure.zcml runtimeinfo.pt runtimeinfo.py server-control.pt 
	zodbcontrol.pt zodbcontrol.py 
Log Message:
Internationalized a whole bunch templates and screens. I also took the 
oppurtunity to clean some old code up. 

I noticed that particularly the basic Content Objects are in bad shape.

There is still a lot left to do!


=== Zope3/src/zope/app/browser/applicationcontrol/configure.zcml 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/applicationcontrol/configure.zcml:1.6	Sun Aug  3 13:48:41 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/configure.zcml	Wed Aug  6 10:41:20 2003
@@ -1,22 +1,17 @@
-<configure
-   xmlns="http://namespaces.zope.org/zope"
-   xmlns:browser="http://namespaces.zope.org/browser"
-   i18n_domain="zope"
-   >
+<configure xmlns="http://namespaces.zope.org/browser">
 
-  <!-- ServerControl View Directives -->
-  <browser:pages
+  <pages
       for="zope.app.interfaces.applicationcontrol.IApplicationControl"
       permission="zope.ManageApplication"
       class=
          "zope.app.browser.applicationcontrol.servercontrol.ServerControlView">
     
-    <browser:page name="ServerControlForm.html" template="server-control.pt" 
-                  menu="zmi_views" title="Server Control" />
-    <browser:page name="ServerControl.html" attribute="action" />
-  </browser:pages>
+    <page name="ServerControlForm.html" template="server-control.pt" 
+          menu="zmi_views" title="Server Control" />
+    <page name="ServerControl.html" attribute="action" />
+  </pages>
  
-  <browser:page
+   <page
       for="zope.app.interfaces.applicationcontrol.IApplicationControl"
       name="index.html"
       menu="zmi_views"
@@ -25,7 +20,7 @@
       class="zope.app.browser.applicationcontrol.runtimeinfo.RuntimeInfoView" 
       permission="zope.ManageApplication"/>
 
-  <browser:page
+  <page
       for="zope.app.interfaces.applicationcontrol.IApplicationControl"
       name="ZODBControl.html"
       template="zodbcontrol.pt"


=== Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.pt 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.pt:1.3	Tue Apr  8 16:35:25 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.pt	Wed Aug  6 10:41:20 2003
@@ -1,26 +1,48 @@
-<html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
+<html metal:use-macro="views/standard_macros/page">
 <head>
-<title i18n:translate="">Zope Runtime Information</title>
+  <title i18n:translate="">Zope Runtime Information</title>
 </head>
 <body>
 <div metal:fill-slot="body">
 
-<ul tal:define="runtime_info view/runtimeInfo">
-   <li><span i18n:translate="">Zope version: </span><span tal:replace="runtime_info/ZopeVersion" /></li>
-   <li><span i18n:translate="">Python version: </span><span tal:replace="runtime_info/PythonVersion" /></li>
-   <li><span i18n:translate="">System platform: </span><span tal:replace="runtime_info/SystemPlatform" /></li>
-   <li><span i18n:translate="">Command line: </span><span tal:replace="runtime_info/CommandLine" /></li>
-   <li><span i18n:translate="">Process id: </span><span tal:replace="runtime_info/ProcessId" /></li>
-   <li><span i18n:translate="">Uptime: </span><span tal:replace="runtime_info/Uptime" /></li>
-   <li><span i18n:translate="">Python path: </span></li>
-      <ul>
-        <li tal:repeat="path runtime_info/PythonPath" tal:content="path">path</li>
-      </ul>
-   <!-- # XXX UI folks: following line want's special attention. The hardcoding should
-          be removed someday. -->
-   <li tal:condition="runtime_info/Hint | nothing" style="color:red;"
-       tal:content="runtime_info/Hint" i18n:translate="" />
-</ul>
+  <ul tal:define="runtime_info view/runtimeInfo">
+     <li>
+       <span i18n:translate="">Zope version: </span>
+       <span tal:replace="runtime_info/ZopeVersion" />
+     </li>
+     <li>
+       <span i18n:translate="">Python version: </span>
+       <span tal:replace="runtime_info/PythonVersion" />
+     </li>
+     <li>
+       <span i18n:translate="">System platform: </span>
+       <span tal:replace="runtime_info/SystemPlatform" />
+     </li>
+     <li>
+       <span i18n:translate="">Command line: </span>
+       <span tal:replace="runtime_info/CommandLine" />
+     </li>
+     <li>
+       <span i18n:translate="">Process id: </span>
+       <span tal:replace="runtime_info/ProcessId" />
+     </li>
+     <li>
+       <span i18n:translate="">Uptime: </span>
+       <span tal:replace="runtime_info/Uptime" />
+     </li>
+     <li>
+       <span i18n:translate="">Python path: </span>
+       <ul>
+         <li tal:repeat="path runtime_info/PythonPath" 
+             tal:content="path">path</li>
+       </ul>
+     </li>
+
+     <!-- # XXX UI folks: following line want's special attention. The
+            hardcoding should be removed someday. -->
+     <li tal:condition="runtime_info/Hint | nothing" style="color:red;"
+         tal:content="runtime_info/Hint" i18n:translate="" />
+  </ul>
 
 </div>
 </body>


=== Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.py:1.4	Thu Jul 31 17:37:27 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.py	Wed Aug  6 10:41:20 2003
@@ -19,6 +19,7 @@
 from zope.component import getAdapter
 from zope.component import ComponentLookupError
 
+from zope.app.i18n import ZopeMessageIDFactory as _
 
 class RuntimeInfoView:
 
@@ -47,14 +48,18 @@
             uptime = uptime - minutes * 60
 
             seconds = uptime
-            # XXX Uptime still to be localized
-            formatted['Uptime'] = "%s%02d:%02d:%02d" % (
-                ((days or "") and "%d days, " % days), hours, minutes, seconds)
+
+            uptime = _('${days} day(s) ${hours}:${minutes}:${seconds}')
+            uptime.mapping = {'days': '%d' %days,
+                              'hours': '%02d' %hours,
+                              'minutes': '%02d' %minutes,
+                              'seconds': '%02d' %seconds}
+
+            formatted['Uptime'] = uptime
 
         except ComponentLookupError:
-            # XXX We avoid having errors in the ApplicationController,
+            # We avoid having errors in the ApplicationController,
             # because all those things need to stay accessible.
-            # Everybody ok with that?
             formatted['ZopeVersion'] = "N/A"
             formatted['PythonVersion'] = "N/A"
             formatted['PythonPath'] = "N/A"


=== Zope3/src/zope/app/browser/applicationcontrol/server-control.pt 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/applicationcontrol/server-control.pt:1.3	Tue Apr  8 16:35:25 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/server-control.pt	Wed Aug  6 10:41:20 2003
@@ -1,14 +1,16 @@
 <html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
 <head>
-<title i18n:translate="">Zope Stub Server Controller</title>
+  <title i18n:translate="">Zope Stub Server Controller</title>
 </head>
 <body>
 <div metal:fill-slot="body">
 
- <form name="servercontrol" action="ServerControl.html" method="post">
-  <input type="submit" name="restart" value="Restart server" i18n:attributes="value" /> <br />
-  <input type="submit" name="shutdown" value="Shutdown server" i18n:attributes="value" /> <br />
- </form>
+  <form name="servercontrol" action="ServerControl.html" method="post">
+    <input type="submit" name="restart" value="Restart server" 
+        i18n:attributes="value" /> <br />
+    <input type="submit" name="shutdown" value="Shutdown server" 
+        i18n:attributes="value" /> <br />
+  </form>
  
 </div>
 </body>


=== Zope3/src/zope/app/browser/applicationcontrol/zodbcontrol.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/applicationcontrol/zodbcontrol.pt:1.1	Thu Jul 31 17:37:27 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/zodbcontrol.pt	Wed Aug  6 10:41:20 2003
@@ -1,12 +1,13 @@
 <html metal:use-macro="views/standard_macros/page">
   <head>
-    <title>ZODB Controller</title>
+    <title i18n:translate="">ZODB Controller</title>
   </head>
   <body>
     <div metal:fill-slot="body">
 
-      <div style="font-size: 120%">
-        Size of file: <em tal:content="view/getDatabaseSize">1.1 MB</em>
+      <div style="font-size: 120%" i18n:translate="">
+        Size of file: <em tal:content="view/getDatabaseSize" 
+                          i18n:name="size">1.1 MB</em>
       </div>
 
       <p tal:define="status view/pack"
@@ -15,14 +16,16 @@
 
       <form action="." method="POST" tal:attributes="action request/URL">
         <div class="row">
-          <div class="label">Keep up to:</div>
-          <div class="view">
-            <input type="text" size="4" name="days" value="0"/> days
+          <div class="label" i18n:translate="">Keep up to:</div>
+          <div class="view" i18n:translate="">
+            <input type="text" size="4" name="days" value="0"
+              i18n:name="days_input" /> days
           </div> 
         </div>
         <div class="row">
           <div class="control">
-            <input type="submit" name="PACK" value="Pack" />
+            <input type="submit" name="PACK" value="Pack" 
+                i18n:attributes="value pack-button"/>
           </div>
         </div>
       </form>


=== Zope3/src/zope/app/browser/applicationcontrol/zodbcontrol.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/applicationcontrol/zodbcontrol.py:1.1	Thu Jul 31 17:37:27 2003
+++ Zope3/src/zope/app/browser/applicationcontrol/zodbcontrol.py	Wed Aug  6 10:41:20 2003
@@ -20,31 +20,38 @@
 from zope.app.interfaces.applicationcontrol import IZODBControl
 from zope.component import getAdapter
 
+from zope.app.i18n import ZopeMessageIDFactory as _
 
 class ZODBControlView:
 
-     def getDatabaseSize(self):
-         zodbcontrol = getAdapter(self.context, IZODBControl)
-         size = zodbcontrol.getDatabaseSize(
-                    self.request.publication.db)
-         if size > 1024**2:
-             return "%.1f MB" %(float(size)/1024**2)
-         elif size > 1024:
-             return "%.1f kB" %(float(size)/1024)
-         else:
-             return "%i Bytes" %size
+    def getDatabaseSize(self):
+        """Get the database size in a human readable format."""
+        zodbcontrol = getAdapter(self.context, IZODBControl)
+        size = zodbcontrol.getDatabaseSize(self.request.publication.db)
+        if size > 1024**2:
+            size_str = _("${size} MB")
+            size_str.mapping = {'size': "%.1f" %(float(size)/1024**2)}
+        elif size > 1024:
+            size_str = _("${size} kB")
+            size_str.mapping = {'size': "%.1f" %(float(size)/1024)}
+        else:
+            size_str = _("${size} Bytes")
+            size_str.mapping = {'size': "%i" %size}
 
-     def pack(self):
-         """Do the packing!"""
-         status = ''
+        return size_str
+        
 
-         if 'PACK' in self.request:
-              zodbcontrol = getAdapter(self.context, IZODBControl)
-              try:
-                   zodbcontrol.pack(self.request.publication.db,
-                                    int(self.request.get('days', 0)))
-                   status = _('ZODB successfully packed.')
-              except FileStorageError, err:
-                   status = _(err)
-
-         return status
+    def pack(self):
+        """Do the packing!"""
+        status = ''
+        
+        if 'PACK' in self.request:
+            zodbcontrol = getAdapter(self.context, IZODBControl)
+            try:
+                zodbcontrol.pack(self.request.publication.db,
+                                 int(self.request.get('days', 0)))
+                status = _('ZODB successfully packed.')
+            except FileStorageError, err:
+                status = _(err)
+                
+        return status




More information about the Zope3-Checkins mailing list