On 8/2/07, Hermann Himmelbauer <[EMAIL PROTECTED]> wrote:
>     mylist = []
>
>     @button.buttonAndHandler(_(u'Suchen'), name='suchen')
>     def handle_suchen(self, action):
>              self.mylist.append(123)
>
> When I output "mylist" in my page template, the number 123 is appended to
> mylist if I press the "Suchen" button, so if I press it 5 times, the list
> holds 5 items. When I restart my zope instance, the list is empty again.

The attribute will be "persistent" so long as you don't restart the
process, *because* it's a class attribute.  Note that the code you
showed never sets the value of self.mylist, but only mutates the
existing value.

To not have a semi-persistent self.mylist, do this instead:

    def handle_suchen(self, action):
             self.mylist = [123]


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to