[Zope3-checkins] CVS: Zope3/src/zope/app/applicationcontrol/browser
- zodbcontrol.pt:1.2 zodbcontrol.py:1.3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 23 10:52:31 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/applicationcontrol/browser
In directory cvs.zope.org:/tmp/cvs-serv1704/src/zope/app/applicationcontrol/browser
Modified Files:
zodbcontrol.pt zodbcontrol.py
Log Message:
Do ZODB control correctly using API calls. Yipee!
=== Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.pt:1.1 Mon Mar 1 08:43:25 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.pt Tue Mar 23 10:52:00 2004
@@ -6,8 +6,13 @@
<div metal:fill-slot="body">
<div style="font-size: 120%" i18n:translate="">
- Size of file: <em tal:content="view/getDatabaseSize"
- i18n:name="size">1.1 MB</em>
+ Name of database: <em tal:content="view/getName"
+ i18n:name="name">My Database</em>
+ </div>
+
+ <div style="font-size: 120%" i18n:translate="">
+ Size of database: <em tal:content="view/getSize"
+ i18n:name="size">1.1 MB</em>
</div>
<p tal:define="status view/pack"
@@ -18,7 +23,9 @@
<div class="row">
<div class="label" i18n:translate="">Keep up to:</div>
<div class="view">
- <input type="text" size="4" name="days" value="0" /><span tal:omit-tag="" i18n:translate="">days</span>
+ <input type="text" size="4" name="days" value="0"
+ tal:attributes="value request/days|string:0" />
+ <span tal:omit-tag="" i18n:translate="">days</span>
</div>
</div>
<div class="row">
=== Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.py:1.2 Sat Mar 6 11:50:12 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/zodbcontrol.py Tue Mar 23 10:52:00 2004
@@ -16,16 +16,17 @@
$Id$
"""
from ZODB.FileStorage.FileStorage import FileStorageError
-from zope.app.applicationcontrol.interfaces import IZODBControl
-
from zope.app.i18n import ZopeMessageIDFactory as _
class ZODBControlView:
- def getDatabaseSize(self):
+ def getName(self):
+ """Get the database name."""
+ return self.request.publication.db.getName()
+
+ def getSize(self):
"""Get the database size in a human readable format."""
- zodbcontrol = IZODBControl(self.context)
- size = zodbcontrol.getDatabaseSize(self.request.publication.db)
+ size = self.request.publication.db.getSize()
if size > 1024**2:
size_str = _("${size} MB")
size_str.mapping = {'size': "%.1f" %(float(size)/1024**2)}
@@ -41,13 +42,11 @@
def pack(self):
"""Do the packing!"""
+ days = int(self.request.form.get('days', 0))
status = ''
-
if 'PACK' in self.request:
- zodbcontrol = IZODBControl(self.context)
try:
- zodbcontrol.pack(self.request.publication.db,
- int(self.request.get('days', 0)))
+ self.request.publication.db.pack(days=days)
status = _('ZODB successfully packed.')
except FileStorageError, err:
status = _(err)
More information about the Zope3-Checkins
mailing list