Skip to content

Instantly share code, notes, and snippets.

@saghul
Created January 24, 2011 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saghul/793936 to your computer and use it in GitHub Desktop.
Save saghul/793936 to your computer and use it in GitHub Desktop.
Decorator for deferring a function to a thread on Twisted
def defer_to_thread(func):
"""Decorator to run DB queries in Twisted's thread pool"""
def wrapper(*args, **kw):
return deferToThread(func, *args, **kw)
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment