--- a/iro/model/decorators.py Fri Jan 27 21:21:41 2012 +0100
+++ b/iro/model/decorators.py Sat Jan 28 04:00:47 2012 +0100
@@ -13,13 +13,11 @@
return f(*args, **kwargs)
return wrapper
-from .utils import WithSession
-#@dbdefer
-def vTyp(value,field):
- with WithSession(dbdefer.engine) as session:
- for typ in session.query(Offer.typ).distinct():
- if value == typ[0]:
- break
- else:
- raise ValidateException(field=field,msg='Typ is not valid.')
+@dbdefer
+def vTyp(value,field, session):
+ for typ in session.query(Offer.typ).distinct():
+ if value == typ[0]:
+ break
+ else:
+ raise ValidateException(field=field,msg='Typ is not valid.')
return value