Re: [Zope] TALES expression

2008-07-16 Thread Martijn Jacobs



Hi!
Please consider this TALES expression:

div class=DataPrevista tal:content='here/getDataInici | string: 
nosta' /


If I try this other: div tal:content='string:${here/getDataInici}' / 
the result is divNone/div


Then the first one will render the alternate expression isn't it?

Then with it renders div class=DataPrevista / ?

Thanks!


I don't understand what you are asking. Could you describe your question 
more clear please.



Martijn.

--
Martijn Jacobs
Four Digits, Internet Solutions

a: Willemsplein 15-1 6811 KB Arnhem NL 
kvk: 09162137 | btw: 8161.22.234.B01

e-mail: [EMAIL PROTECTED] | web: http://www.fourdigits.nl
tel: +31 (0)26 44 22 700 | fax: +31 (0)84 22 06 117 


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TALES expression

2008-07-16 Thread Garito
If this assuption is correct why the result is div class=DataPrevista /?

2008/7/16 Martijn Jacobs [EMAIL PROTECTED]:

  That assumption is correct

  I mean some TALES expression as here/getDataInici | string: nosta will
 evaluate here/getDataInici and if this expression returns '', 0 or None the
 tal interpreter evaluates the second one and the result of this TALES
 expression will be nosta as string

 Is this assumption correct?

 Thanks!

 2008/7/16 Martijn Jacobs [EMAIL PROTECTED]:


  Hi!
 Please consider this TALES expression:

 div class=DataPrevista tal:content='here/getDataInici | string: nosta'
 /

 If I try this other: div tal:content='string:${here/getDataInici}' /
 the result is divNone/div

 Then the first one will render the alternate expression isn't it?

 Then with it renders div class=DataPrevista / ?

 Thanks!


  I don't understand what you are asking. Could you describe your question
 more clear please.


 Martijn.

 --
 Martijn Jacobs
 Four Digits, Internet Solutions

 a: Willemsplein 15-1 6811 KB Arnhem NL kvk: 09162137 | btw:
 8161.22.234.B01
 e-mail: [EMAIL PROTECTED] | web: http://www.fourdigits.nl
 tel: +31 (0)26 44 22 700 | fax: +31 (0)84 22 06 117




 --
 Mis Cosas
 http://blogs.sistes.net/Garito
 Zope Smart Manager
 http://blogs.sistes.net/Garito/670



 --
 Martijn Jacobs
 Four Digits, Internet Solutions

 a: Willemsplein 15-1 6811 KB Arnhem NL
 kvk: 09162137 | btw: 8161.22.234.B01
 e-mail: [EMAIL PROTECTED] | web: http://www.fourdigits.nl
 tel: +31 (0)26 44 22 700 | fax: +31 (0)84 22 06 117




-- 
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TALES expression

2008-07-16 Thread Tino Wildenhain

Garito wrote:

Hi!
Please consider this TALES expression:

div class=DataPrevista tal:content='here/getDataInici | string: nosta' /

If I try this other: div tal:content='string:${here/getDataInici}' / 
the result is divNone/div


Then the first one will render the alternate expression isn't it?

Then with it renders div class=DataPrevista / ?


Сто? ;-)

You should check the tales documentation. the pipe symbol |
means a logical or, in effect if the left expression resolves
to non existent, None, empty object,... (generally python False)
the right part of it is evaluated.

In the special case it probably is nicer to use:

div class=DataPrevista tal:content=here/getDataInici | 
defaultnosta/div instead so the fallback value is part

of the template (TAL is meant to be design by example)

I would also recommend not mixing  and ' for attributes and
maybe in the long run sticking to english language names for
your objects makes it easier to ask on mailinglists.

Regards
Tino



smime.p7s
Description: S/MIME Cryptographic Signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TALES expression

2008-07-16 Thread Fred Drake
On Wed, Jul 16, 2008 at 6:34 AM, Tino Wildenhain [EMAIL PROTECTED] wrote:
 You should check the tales documentation. the pipe symbol |
 means a logical or, in effect if the left expression resolves
 to non existent, None, empty object,... (generally python False)
 the right part of it is evaluated.

Not at all.

The pipe uses the left-hand operand if it is defined; a value of None
or an empty string is still a defined value.  As long as here can be
traversed with the name getDataInici then the left-hand expression
will be used.  If that traversal fails the right-hand expression will
be used instead.


 -Fred

-- 
Fred L. Drake, Jr. fdrake at gmail.com
Chaos is the score upon which reality is written. --Henry Miller
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TALES expression

2008-07-16 Thread Tino Wildenhain

Fred Drake wrote:

On Wed, Jul 16, 2008 at 6:34 AM, Tino Wildenhain [EMAIL PROTECTED] wrote:

You should check the tales documentation. the pipe symbol |
means a logical or, in effect if the left expression resolves
to non existent, None, empty object,... (generally python False)
the right part of it is evaluated.


Not at all.

The pipe uses the left-hand operand if it is defined; a value of None
or an empty string is still a defined value.  As long as here can be
traversed with the name getDataInici then the left-hand expression
will be used.  If that traversal fails the right-hand expression will
be used instead.


Indeed :-)

Cheers
Tino


smime.p7s
Description: S/MIME Cryptographic Signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )