From: Gabriel <ga...@op...> - 2009-02-19 18:04:20
|
Hi all, just a question, are you planning to add events RowDestroyedSignal and RowUpdatedSignal, in other words events that are invoked after and not before like de actual ones. Just the same as RowCreatedSignal and RowCreateSignal -- Kind Regards |
From: Oleg B. <ph...@ph...> - 2009-02-19 18:25:06
|
On Thu, Feb 19, 2009 at 04:04:16PM -0200, Gabriel wrote: > just a question, are you planning to add events RowDestroyedSignal and > RowUpdatedSignal, in other words events that are invoked after and not > before like de actual ones. > Just the same as RowCreatedSignal and RowCreateSignal I don't, but you are welcome to provide a patch and a test. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Gabriel <ga...@op...> - 2009-02-20 13:28:54
Attachments:
main.diff
events.diff
|
On Thu, Feb 19, 2009 at 4:24 PM, Oleg Broytmann <ph...@ph...> wrote: > On Thu, Feb 19, 2009 at 04:04:16PM -0200, Gabriel wrote: >> just a question, are you planning to add events RowDestroyedSignal and >> RowUpdatedSignal, in other words events that are invoked after and not >> before like de actual ones. >> Just the same as RowCreatedSignal and RowCreateSignal > > I don't, but you are welcome to provide a patch and a test. > > Oleg. Attached patch with new events RowDestroyedSignal and RowUpdatedSignal. gmail doesn't allow me to send the test in a file, so I'm pasting it here, sorry. -- Kind Regards #---- TEST FOR EVENTS ---- from sqlobject import * from sqlobject.events import listen, RowDestroySignal, RowCreatedSignal, RowDestroyedSignal, RowUpdateSignal, RowUpdatedSignal database = 'sqlite:/temp/test.db' conn = connectionForURI(database + "?debug=1") sqlhub.processConnection = conn class A(SQLObject): class sqlmeta: lazyUpdate = True name = StringCol() def rowCreated(arg, post): print "CREATED" print list(A.select()) def rowDelete(inst, post): print "BEFORE DELETE" print list(A.select()) def rowDeleted(inst): print "DELETED" print list(A.select()) def rowUpdate(inst, args): print "UPDATE" print list(A.select()) def rowUpdated(inst): print "UPDATED" print list(A.select()) listen(rowCreated, A, RowCreatedSignal) listen(rowDelete, A, RowDestroySignal) listen(rowDeleted, A, RowDestroyedSignal) listen(rowUpdate, A, RowUpdateSignal) listen(rowUpdated, A, RowUpdatedSignal) A.createTable() print "INSERTING DATA" a = A(name="Pepe") a = A.get(1) a.name = "Pepe2" a.syncUpdate() a.destroySelf() |
From: Oleg B. <ph...@ph...> - 2009-02-20 13:33:23
|
On Fri, Feb 20, 2009 at 11:28:50AM -0200, Gabriel wrote: > Attached patch with new events RowDestroyedSignal and RowUpdatedSignal. Thank you! I will look at it... I hope, tomorrow... Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2009-02-21 18:44:37
|
On Fri, Feb 20, 2009 at 11:28:50AM -0200, Gabriel wrote: > Attached patch with new events RowDestroyedSignal and RowUpdatedSignal. I added a call to send RowUpdatedSignal after .set(); also added post-functions for both signals. I didn't use your tests - instead I copied and modified test_row_update and test_row_destroy in tests/test_events.py. Everything is now in the trunk, commit 3792. Will be in 0.11 when it will be released. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Gabriel <ga...@op...> - 2009-02-21 23:16:26
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Oleg Broytmann escribió: > I added a call to send RowUpdatedSignal after .set(); also added > post-functions for both signals. I didn't use your tests - instead I copied > and modified test_row_update and test_row_destroy in tests/test_events.py. > Everything is now in the trunk, commit 3792. Will be in 0.11 when it > will be released. > > Oleg. Good to know :) Thanks. - -- Kind regards. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEAREIAAYFAkmgix0ACgkQNHr4BkRe3pKiIACdHQF5t9OEfnRDSg6DQH+Awrgp hwMAnROBS3bxPPMRqBh9eFW39xHLhT8O =hHmF -----END PGP SIGNATURE----- |