Re: [Zope] Global Variable In PT

2007-08-24 Thread Dieter Maurer
[EMAIL PROTECTED] wrote at 2007-8-23 13:47 -0400:
 ...
I have this code (editing out the extraneous) at the beginning of a page:

body bgcolor=#ff 
  tal:define=newRow string:yes

After calling some other variables (specifically rotating through a changing 
¨item¨ (for item in items...)), I try and change newRow:

span tal:define=global newRow item/newRow tal:omit-tag= /

Then I try and call newRow:

p tal:replace=newRow /

But it gives me the original value. Now, if I edit the page like this:

span tal:define=global newRow item/newRow tal:omit-tag=
p tal:replace=newRow /
/span

This means, you already have found a solution to your problem:

  Use global consistently for your variables.

I think, I also have read a specification how global and local
definitions for the same variable interact. When I remember right (but
I am not sure), then what you is is consistent with the specification.



-- 
Dieter
___
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] Global Variable In PT

2007-08-23 Thread Andreas Jung



--On 23. August 2007 13:47:15 -0400 [EMAIL PROTECTED] wrote:


Hi:
I have this code (editing out the extraneous) at the beginning of a page:

body bgcolor=#ff
  tal:define=newRow string:yes

After calling some other variables (specifically rotating through a
changing ¨item¨ (for item in items...)), I try and change newRow:



Using 'global' is basically bad-style. It is even more bad-style to modify 
global variables in ZPT. Rethink your problem. If necessary move the related

code into a Python script.

-aj

pgpZ69HCeLXYf.pgp
Description: PGP 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 )