Varias llamadas a un método de portlet en la clase Renderer

I'm creating a portlet based on Base Portlet.

In the Renderer class, I've defined a method like this :

def myMethod(self):
    """ """"hou yeah")

In the portlet's template I call view/myMethod

In the root site, I add my portlet.

Etc. ..

Es este un comportamiento normal ?

¿Hay alguna forma de solucionarlo?


preguntado el 09 de marzo de 12 a las 13:03

Showing some code always helps ;) -

Have you tried putting in a pdb.set_trace() and looking at the stack every time your method is hit? Type w to see the call stack to see what is calling your method every time. -

1 Respuestas

It is a normal behaviour, I think. you've just to find which transaction was the right one. The others are deleted by zope transactions handling.

respondido 12 mar '12, 08:03

this is not correct.. what has this got to do with transactions? - claro queshvv

This has been my experience in similar methods. - Yuri

Think you misunderstand transactions. The idea is the changes to the Database will get committed at the end of the request if it succeeds - otherwise nothing will be committed to the database and the ZODB will be left in the same state as the beginning of the request. Methods will not be called multiple times. - claro queshvv

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.