[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Internationalized apidoc modules description.

Jim Fulton jim at zope.com
Thu Sep 2 07:44:43 EDT 2004


Stephan Richter wrote:
> On Thursday 02 September 2004 03:59, Dmitry Vasiliev wrote:
> 
>>Modified: Zope3/trunk/src/zope/i18n/__init__.py
>>===================================================================
>>--- Zope3/trunk/src/zope/i18n/__init__.py       2004-09-02 07:05:38 UTC
>>(rev 27409) +++ Zope3/trunk/src/zope/i18n/__init__.py       2004-09-02
>>07:59:06 UTC (rev 27410) @@ -17,6 +17,7 @@
>> """
>> 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
>>@@ -33,6 +34,7 @@
>> def _translate(msgid, domain=None, mapping=None, context=None,
>>                target_language=None, default=None):
>> 
>>+    msgid = removeSecurityProxy(msgid)
>> 
>>     if isinstance(msgid, MessageID):
>>         domain = msgid.domain
> 
> 
> Dimitry,
> 
> this is unacceptable,

Right. This change needs to be backed out.

 > since it creates a dependence of zope.security in
> zope.i18n.

And because it uses removeSecurityProxy(msgid) without explaining why.
This is almost certainly not necessary.

 > Since this problem occurred only as you internationalized API doc,
> we should be able to quickly determine the place where we should call the 
> removeSecurityProxy() call.

A better aproach is to add necessary security declarations for message ids.

It would be nice if we could make message ids into "rocks" so they didn't
have to be proxied.  We would have to make them immutable though, and
be careful about the data they contained.

Good catch Stephan.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-Checkins mailing list