--- a/iro/model/utils.py Thu Jan 26 01:23:04 2012 +0100
+++ b/iro/model/utils.py Fri Jan 27 15:01:59 2012 +0100
@@ -3,6 +3,8 @@
from twisted.internet import threads
from twisted.python.threadpool import ThreadPool
+from functools import wraps
+
POOL_SIZE=5 #how many threads should the db connector pool should have
class Data:
@@ -19,6 +21,7 @@
def run_in_db_thread(f):
"""Decorator to run DB queries in Twisted's thread pool"""
+ @wraps(f)
def wrapper(*args, **kwargs):
return threads.deferToThreadPool(d.reactor, d.pool, f, *args, **kwargs)
return wrapper
@@ -50,6 +53,7 @@
def __call__(self, func):
@run_in_db_thread
+ @wraps(func)
def wrapper(*args, **kwargs):
with WithSession(self.engine, self.autocommit) as session:
return func(*args, session=session, **kwargs)