--- a/iro/model/pool.py Thu Mar 29 13:46:37 2012 +0200
+++ b/iro/model/pool.py Thu Mar 29 16:27:40 2012 +0200
@@ -1,18 +1,23 @@
from decorator import decorator
import sqlalchemy
class Data:
+ """A very simple class to save the thread pool for database requests"""
def __init__(self):
self.pool = None
data = Data()
-#a valid dbDefer decorator
+"""holds connection to the actual thread pool for the database requests"""
def setPool(pool):
+ """setting the thread pool"""
data.pool = pool
@decorator
def runInDBPool(f,*args,**kwargs):
- """Decorator to run DB queries in Twisted's thread pool"""
+ """Decorator to run DB queries in Twisted's thread pool.
+
+ If last argument is a session object, the function is called directly.
+ """
if isinstance(args[-1],sqlalchemy.orm.session.Session):
return f(*args,**kwargs)
else: