On Thu, Feb 19, 2009 at 4:24 PM, Oleg Broytmann <[email protected]> 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()
main.diff
Description: Binary data
events.diff
Description: Binary data
------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ sqlobject-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
