I want to use the @after_insert decorator of Elixir, but i can't access the Session within the model. Since i have autocommit set to False, i can't commit any changes in the event handler. Is there any best practice how to deal with that?
The Code I used to build model, database connection etc. are mostly taken off the documentations.
The desired method:
class Artefact(Entity):
[...]
@after_insert
def make_signature(self):
self.signature = '%s-%s' % (self.artefact_type.title.upper()[:3], self.id)
All the Session initialization is done in the init.py in the same directory.
When I then call:
Session.update(self)
Session.commit()
I get an error that Session is undefined. Any idea?