Handling object changes
Hi all, I'm looking for some method to handle changes on my objects. I'm interested in persistence changes. I know I should be able to handle some changes writting a __setattr__ method, but I'm also interested into handle changes even if they are done in a list attribute, or in a dictionary attribute. That's it, I would be able to handle any changed market in the "self._p_changed = 1" way, but I'm not able to find the piece of code doing this work. Anybody knows if it is possible ? If not, anybody knows where is the logic doing this work in Zope (Connection, Storage, Persistence, ...) ? Thanks in advance Santi Camps
Hi I think that the solution is writing a Python script that changes your objects, something like: for object in yourobjects: bject.newproperty = value bject._p_changed = 1 and after that all objects have a new property 'newproperty' with the value 'value' I hope this will help. Regards, Dragos
Hi all,
I'm looking for some method to handle changes on my objects. I'm interested in persistence changes. I know I should be able to handle some changes writting a __setattr__ method, but I'm also interested into handle changes even if they are done in a list attribute, or in a dictionary attribute. That's it, I would be able to handle any changed market in the "self._p_changed = 1" way, but I'm not able to find the piece of code doing this work.
Anybody knows if it is possible ? If not, anybody knows where is the logic doing this work in Zope (Connection, Storage, Persistence, ...) ?
Thanks in advance
Santi Camps
_______________________________________________ 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 )
--On Freitag, 4. Juni 2004 16:19 Uhr +0000 Santi Camps <santi@zetadb.com> wrote:
Hi all,
I'm looking for some method to handle changes on my objects. I'm interested in persistence changes. I know I should be able to handle some changes writting a __setattr__ method, but I'm also interested into handle changes even if they are done in a list attribute, or in a dictionary attribute. That's it, I would be able to handle any changed market in the "self._p_changed = 1" way, but I'm not able to find the piece of code doing this work.
This stuff is documented in the Zope Developers Guide and the two ZODB for programmers articles somewhere in the docs section on zope.org. -aj
En/na Andreas Jung ha escrit:
--On Freitag, 4. Juni 2004 16:19 Uhr +0000 Santi Camps <santi@zetadb.com> wrote:
Hi all,
I'm looking for some method to handle changes on my objects. I'm interested in persistence changes. I know I should be able to handle some changes writting a __setattr__ method, but I'm also interested into handle changes even if they are done in a list attribute, or in a dictionary attribute. That's it, I would be able to handle any changed market in the "self._p_changed = 1" way, but I'm not able to find the piece of code doing this work.
This stuff is documented in the Zope Developers Guide and the two ZODB for programmers articles somewhere in the docs section on zope.org.
-aj
Sorry, I think I've not explained very well. What I want to do is not know how I should use persistence, but how I can detect that something persistent has changed on my object. The purpose of this is write a base class able to handle any change of its descendants and put some code there. Just like a trigger in a RDBMS. I think that have a trigger-like functionallity will be very useful in some cases, you dont ? Finally, I've found that this stuff is in cPersistence.[ch], writted in C. I will try some thinks. Thanks Santi Camps
participants (3)
-
Andreas Jung -
Dragos Chirila -
Santi Camps