[Zope3-checkins] SVN: Zope3/trunk/src/zope/ removeSecurityProxy() call moved in APIDocumentationView.getModuleList()

Dmitry Vasiliev dima at hlabs.spb.ru
Thu Sep 2 08:05:18 EDT 2004


Log message for revision 27421:
  removeSecurityProxy() call moved in APIDocumentationView.getModuleList()
  


Changed:
  U   Zope3/trunk/src/zope/app/apidoc/browser/apidoc.py
  U   Zope3/trunk/src/zope/i18n/__init__.py


-=-
Modified: Zope3/trunk/src/zope/app/apidoc/browser/apidoc.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/apidoc.py	2004-09-02 11:15:28 UTC (rev 27420)
+++ Zope3/trunk/src/zope/app/apidoc/browser/apidoc.py	2004-09-02 12:05:18 UTC (rev 27421)
@@ -18,6 +18,7 @@
 __docformat__ = 'restructuredtext'
 
 from zope.i18n import translate
+from zope.security.proxy import removeSecurityProxy
 from zope.app.apidoc.utilities import renderText
 
 class APIDocumentationView(object):
@@ -43,8 +44,9 @@
         items.sort()
         result = []
         for name, module in items:
-            description = translate(module.description, context=self.request,
-                                    default=module.description)
+            description = removeSecurityProxy(module.description)
+            description = translate(description, context=self.request,
+                                    default=description)
             description = renderText(description, module.__class__.__module__)
             if not isinstance(description, unicode):
                 description = unicode(description, "utf-8")

Modified: Zope3/trunk/src/zope/i18n/__init__.py
===================================================================
--- Zope3/trunk/src/zope/i18n/__init__.py	2004-09-02 11:15:28 UTC (rev 27420)
+++ Zope3/trunk/src/zope/i18n/__init__.py	2004-09-02 12:05:18 UTC (rev 27421)
@@ -17,7 +17,6 @@
 """
 import re
 import warnings
-from zope.security.proxy import isinstance, removeSecurityProxy
 from zope.component import queryUtility
 from zope.i18nmessageid import MessageIDFactory, MessageID
 from zope.i18n.interfaces import ITranslationDomain
@@ -34,8 +33,6 @@
 def _translate(msgid, domain=None, mapping=None, context=None,
                target_language=None, default=None):
 
-    msgid = removeSecurityProxy(msgid)
-
     if isinstance(msgid, MessageID):
         domain = msgid.domain
         default = msgid.default
@@ -58,9 +55,6 @@
         args = args[1:]
     return _translate(*args, **kw)
 
-    
-
-
 def interpolate(text, mapping):
     """Insert the data passed from mapping into the text"""
 
@@ -82,6 +76,3 @@
         text = text.replace(string, unicode(mapping.get(var)))
 
     return text
-
-
-              



More information about the Zope3-Checkins mailing list