[Zope3-Users] Is a view persistent?

Hermann Himmelbauer dusty at qwer.tk
Thu Aug 2 05:58:02 EDT 2007


Hi,
I have a simple z3c.form - based view for a persistent object. My view has a 
class attribute, which is set during an action, e.g.:

class ViewFoo(form.Form):

    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.

So it seems that the view is somehow persistent, but I don't understand why? 
The view does not inherit from persistent.Persistent and I modify an object 
attribute and not a class attribute?

I thought that a view object is created every time a view is accessed?

Best Regards,
Hermann

-- 
x1 at aon.at
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope3-users mailing list