[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/dav/ Interpolate variables in message ids returned from ISized adapters.

Philipp von Weitershausen philikon at philikon.de
Sun Sep 12 10:46:41 EDT 2004


Log message for revision 27505:
  Interpolate variables in message ids returned from ISized adapters.
  


Changed:
  U   Zope3/trunk/src/zope/app/dav/adapter.py
  U   Zope3/trunk/src/zope/app/dav/tests/test_adapter.py


-=-
Modified: Zope3/trunk/src/zope/app/dav/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/adapter.py	2004-09-12 14:39:47 UTC (rev 27504)
+++ Zope3/trunk/src/zope/app/dav/adapter.py	2004-09-12 14:46:41 UTC (rev 27505)
@@ -20,6 +20,7 @@
 from xml.dom import minidom
 
 from zope.interface import implements
+from zope.i18n import translate
 
 from zope.app import zapi
 from zope.app.dav.interfaces import IDAVSchema
@@ -62,7 +63,7 @@
         sized = ISized(self.context, None)
         if sized is None:
             return ''
-        return str(sized.sizeForDisplay())
+        return str(translate(sized.sizeForDisplay()))
     getcontentlength = property(getcontentlength)
 
     def getlastmodified(self):

Modified: Zope3/trunk/src/zope/app/dav/tests/test_adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_adapter.py	2004-09-12 14:39:47 UTC (rev 27504)
+++ Zope3/trunk/src/zope/app/dav/tests/test_adapter.py	2004-09-12 14:46:41 UTC (rev 27505)
@@ -24,6 +24,7 @@
 from zope.app.tests.placelesssetup import setUp, tearDown
 from zope.app.size.interfaces import ISized
 from zope.app.filerepresentation.interfaces import IReadDirectory
+from zope.app.i18n import ZopeMessageIDFactory as _
 
 import zope.app.location
 from zope.app.dublincore.interfaces import IWriteZopeDublinCore
@@ -52,7 +53,9 @@
         return None
 
     def sizeForDisplay(self):
-        return u"1 robot unit"
+        msg = _(u"${num} robot unit")
+        msg.mapping = {'num': 1}
+        return msg
 
 class RobotDirectory(object):
     implements(IReadDirectory)
@@ -147,4 +150,4 @@
             ))
 
 if __name__ == '__main__':
-    unittest.main()
+    unittest.main(defaultTest='test_suite')



More information about the Zope3-Checkins mailing list