Corrected code in MissingPrincipal translated attributes ZTK-1.1
authorThierry Florac <tflorac@ulthar.net>
Fri, 03 Feb 2012 18:03:58 +0100
branchZTK-1.1
changeset 108 9c4cd620ad0c
parent 107 4722ff4563b3
child 109 9ddf634e6187
Corrected code in MissingPrincipal translated attributes
ztfy/utils/security.py
--- a/ztfy/utils/security.py	Fri Feb 03 17:50:17 2012 +0100
+++ b/ztfy/utils/security.py	Fri Feb 03 18:03:58 2012 +0100
@@ -28,10 +28,14 @@
 from zc.set import Set
 from zope.component import getUtility
 from zope.deprecation.deprecation import deprecate
+from zope.i18n import translate
 from zope.interface import implements
 from zope.security.proxy import removeSecurityProxy
 
 # import local packages
+from ztfy.utils.request import getRequest
+
+from ztfy.utils import _
 
 
 def unproxied(value):
@@ -60,14 +64,15 @@
 
     def __init__(self, id):
         self.id = id
+        self.request = getRequest()
 
     @property
     def title(self):
-        return _("< missing principal %s >") % self.id
+        return translate(_("< missing principal %s >"), context=self.request) % self.id
 
     @property
     def description(self):
-        return _("This principal can't be found in any authentication utility...")
+        return translate(_("This principal can't be found in any authentication utility..."), context=self.request)
 
 
 @deprecate("ztfy.utils.security.getPrincipal is deprecated. Use ztfy.security.search.getPrincipal function instead.")