It looks useful, seems well done (at a quick glance) but... it's
already built-in in Elixir (in a very similar way than what you did).
from elixir.events import *
class MyClass(Entity):
@before_insert
def my_validation_function(self):
[do some stuff]
See:
http://elixir.ematia.de/trac/browser/elixir/trunk/tests/test_events.py
for more examples.
You probably missed it because of our lack of documentation. Sorry
about that. If you have some time, I'd be grateful if you could expand
our tutorial in the Wiki or start a new page introducing events, or
even add a docstring to the events module so that other users don't
need to reimplement the functionality themselves (even though the more
people become familiar with the codebase the better, it's sad when
it's for something already done).
> I took some direction from this guy and cleaned it up:
> http://beachcoder.wordpress.com/2007/05/02/adding-event-callbacks-to-sqlalchemyelixir-classes/
Yes, he was actually the starting point for our own implementation as well.
--
Gaëtan de Menten
http://openhex.org