/usr/share/pyshared/elixir/events.py is in python-elixir 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | __all__ = [
'before_insert',
'after_insert',
'before_update',
'after_update',
'before_delete',
'after_delete',
'reconstructor'
]
def create_decorator(event_name):
def decorator(func):
if not hasattr(func, '_elixir_events'):
func._elixir_events = []
func._elixir_events.append(event_name)
return func
return decorator
before_insert = create_decorator('before_insert')
after_insert = create_decorator('after_insert')
before_update = create_decorator('before_update')
after_update = create_decorator('after_update')
before_delete = create_decorator('before_delete')
after_delete = create_decorator('after_delete')
try:
from sqlalchemy.orm import reconstructor
except ImportError:
def reconstructor(func):
raise Exception('The reconstructor method decorator is only '
'available with SQLAlchemy 0.5 and later')
|