I seem to have stumbled upon a bug, but perhaps I'm just using MapperExtension wrong. Anyway, here's some code that doesn't work:
----------- from sqlalchemy import * from sqlalchemy.orm import MapperExtension global_session = create_session() metadata = BoundMetaData('mysql://[EMAIL PROTECTED]/napa') test_table = Table('test', metadata, Column('tid', Integer, primary_key = True), Column('modified', DateTime), Column('foo', String(1024))) class Test(object): def __init__(self, foo): self.foo = foo class ModifiedMapper(MapperExtension): #whenever something is changed, this will make sure the modified is set def before_update(self, mapper, connection, instance): instance.modified = func.now() testmapper = mapper(Test, test_table, extension=ModifiedMapper) def main(): test = Test("foo") global_session.save(test) global_session.flush() global_session.delete(test) global_session.flush() if __name__=="__main__": main() --------- And here's the stack trace: Traceback (most recent call last): File "test.py", line 33, in ? main() File "test.py", line 25, in main test = Test("foo") File "build/bdist.linux-i686/egg/sqlalchemy/orm/mapper.py", line 548, in init File "build/bdist.linux-i686/egg/sqlalchemy/orm/mapper.py", line 1365, in <lambda> File "build/bdist.linux-i686/egg/sqlalchemy/orm/mapper.py", line 1372, in _do TypeError: unbound method get_session() must be called with ModifiedMapper instance as first argument (got nothing instead) Anybody have any idea what that all means? Am I doing something wrong or is it a bug? -Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---