Guest User

Untitled

a guest
Jan 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. from johnny.cache import get_backend
  2. from itertools import wraps
  3.  
  4. def use_johnny(func):
  5. @wraps(func)
  6. def wrapper(*args, **kwargs):
  7. be = get_backend()
  8. be.patch()
  9. try:
  10. return func(*args, **kwargs)
  11. except:
  12. raise
  13. finally:
  14. be.unpatch()
  15. return wrapper
  16.  
  17. @use_johnny
  18. def my_orm_using_thing():
  19. pass
Add Comment
Please, Sign In to add comment