Make message ids into "rocks", was Re: [Zope3-dev] Re: SVN: Zope3/trunk/src/zope/ Internationalized apidoc modules description.

Jim Fulton jim at zope.com
Fri Sep 3 10:20:13 EDT 2004


Dmitry Vasiliev wrote:
> Jim Fulton wrote:

...


>> But that doesn't prevent the mapping from being changed in the
>> message id. We need to prevent the messaage id's data from being
>> mutated.
> 
> 
> I told about following code:
> 
>     mapping = property(lambda self: self.__mapping.copy())
> 
> So the mapping may be changed only using the % operator, like Philipp 
> suggested.

It many be changed through the _mapping property. Yeah, I know
that's cheating. ;)

>> I suggest we use Python dict proxies, which are proxies
>> used by new-style classes to prevent modification of their
>> dictionaries.  Unfortunately, creation of these is not
>> exposed to Python code. Someone will have to whip up a small
>> C extension to make these creatable from Python.  I've proposed
>> on python-dev to make these creatable from Python, but that wouldn't
>> happen until Python 2.4 at the soonest.
> 
> 
> I don't think it's necessary, Philipp already post the pure Python 
> implementation.

That is totally inadequate, as I showed in my reply.

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-dev mailing list