6
0

__init__.py 259 B

123456789101112131415161718
  1. from functools import wraps
  2. from pycs import db
  3. def commit_on_return(method):
  4. @warps(method)
  5. def inner(self, *args, commit: bool = True, **kwargs):
  6. res = method(self, *args, **kwargs)
  7. if commit:
  8. db.session.commit()
  9. return res
  10. return inner