Depending on how attributes are set on child classes, rowupdatesignal
fires either just on the base class, or on both the base and the child.
This is inconsistent.

from sqlobject import *
from sqlobject.inheritance import InheritableSQLObject

class Base(InheritableSQLObject):
    name = StringCol()

    def _set_name(self, new_name):
        print "base", new_name
        self._SO_set_name(new_name)

class Child(Base):

    def _set_name(self, new_name):
        print "child", new_name
        self._SO_set_name(new_name)


sqlhub.processConnection = connectionForURI('sqlite:/:memory:')

Base.createTable()
Child.createTable()

def rowUpdateb(instance, kwargs):
    print "base signal", instance, kwargs

def rowUpdatec(instance, kwargs):
    print "child signal", instance, kwargs

events.listen(rowUpdateb, Base, events.RowUpdateSignal)
events.listen(rowUpdatec, Child, events.RowUpdateSignal)

c = Child(name="zero")
c.name = "one" #once
c.set(name="two") #twice

-----------
results:

base zero
base one
base signal <Base 1 name='zero'> {'name': 'one'}
child signal <Child 1 name='one'> {'name': 'two'}
base two
base signal <Base 1 name='one'> {'name': 'two'}



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to