Re: [Zope-dev] TAL i18n breakage in 2.7

2004-02-24 Thread Myroslav Opyr
Myroslav Opyr wrote:

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.
I found the offending part in the ZPT that caused the abovementioned
assertion.
I have a pagetemplate that uses master macro from main template, then
the main template includes the other template (portlet) that eposes slot
to be optionally overriden in template using it (main in my case).
test.pt
   ... metal:use-macro=...
   main.pt metal:define-macro
   master
   ... metal:use-macro=...
   portlet.pt metal:define-macro
   portlet
   ... define-slot=...
  /default slot content/
As soon as I remove the level marked with  my page renders fine with no
exception. If I want to expose flexibility of my portlet with that slot,
the whole construct breaks with exception :(
Any hints appreciated,

Regards,

m.
--
Myroslav Opyr
zope.net.ua http://zope.net.ua/ ° Ukrainian Zope Hosting
e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] TAL i18n breakage in 2.7

2004-02-23 Thread Myroslav Opyr
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.77r2=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: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] TAL i18n breakage in 2.7

2004-02-19 Thread Stephan Richter
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.77r2=1
.78

 This will break applications (e.g. Plone1) which use Nuxeo's
 TranslationService, which does return None.  Is there a good reason for
 introducing this compatibility breakage?

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.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] TAL i18n breakage in 2.7

2004-02-19 Thread seb bacon
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.77r2=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

seb



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )