Guest User

Untitled

a guest
Sep 12th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. compress_lock = threading.Lock()
  2.  
  3. @register.tag
  4. def safe_compress(parser, token):
  5. # Force single threaded compression
  6. compress_lock.acquire()
  7. value = None
  8. try:
  9. value = compress(parser, token)
  10. finally:
  11. compress_lock.release()
  12.  
  13. return value
Advertisement
Add Comment
Please, Sign In to add comment