[Zope-dev] TAL i18n breakage in 2.7

Myroslav Opyr myroslav at zope.net.ua
Mon Feb 23 05:10:14 EST 2004


seb bacon wrote:

>On Thu, Feb 19, 2004 at 09:10:30AM -0500, Stephan Richter wrote:
>  
>
>>On Thursday 19 February 2004 08:08, seb bacon wrote:
>>    
>>
>>>Zope 2.7 introduced a change in its translation interface.  Previously a
>>>translation service could return None, but now returning None causes an
>>>assertion error.
>>>
>>>http://cvs.zope.org/Zope/lib/python/TAL/TALInterpreter.py.diff?r1=1.77&r2=1.78
>>>      
>>>
>>That is strange. The Zope 3 translation service can also still return None and 
>>we use the same TAL code. I cannot see which code change would not handle the 
>>None.
>>    
>>
>
>The new implementation would appear to expect the service to return the
>default value passed in, instead of None.
>
>>From the diff linked to above:
>
>r1.77 has:
>
>  xlated_msgid = self.translate(msgid, i18ndict, obj)
>     # If there is no translation available, use evaluated content.
>     if xlated_msgid is None:
>        # do some stuff
>
>r1.78 has:
>
>  xlated_msgid = self.translate(msgid, default, i18ndict, obj)
>  assert xlated_msgid is not None, self.position
>  
>
I always commented all asserts introduced in newer Zopes out. However 
I'm struggling with assertion "TALInterpreter, line 490, in 
do_endI18nContext":
    def do_endI18nContext(self, notused=None):
        self.i18nContext = self.i18nContext.parent
        assert self.i18nContext is not None
Meaning None was produced somewhere (maybe even Translation Service) and 
TALInterpreter does not expect this case to be.

m.
-- 
Myroslav Opyr
zope.net.ua <http://zope.net.ua/> ° Ukrainian Zope Hosting
e-mail: myroslav at zope.net.ua <mailto:myroslav at zope.net.ua>




More information about the Zope-Dev mailing list