Diez B. Roggisch wrote: > Coming from SQLObject, I so far haven't seen a feature of that in Elixir/SA > that would come handy here: the option to bind events to insert/update-row > operations.
Elixir has a system for this built right in, called "events". Take a look at the unit tests for one example: http://elixir.ematia.de/trac/browser/elixir/trunk/tests/test_events.py It basically works like this: from elixir import Entity, Field, String from elixir.events import before_insert from some_library import generate_uuid class Person(Entity): name = Field(String(64)) uuid = Field(String(64)) @before_insert def _initialize(self): self.uuid = generate_uuid() There are event decorators for a variety of "hooks": before_insert after_insert before_update after_update before_delete after_delete We really need some better documentation on this. Contributions are welcome, of course :) -- Jonathan LaCour http://cleverdevil.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
