one remaining staticmethod in iotlabdriver needs dbsession
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 15 Nov 2013 13:48:13 +0000 (14:48 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 15 Nov 2013 13:48:13 +0000 (14:48 +0100)
updated this one, + comments on how to do this properly

sfa/iotlab/iotlabdriver.py

index 910804e..ef920a5 100644 (file)
@@ -3,7 +3,6 @@ Implements what a driver should provide for SFA to work.
 """
 from sfa.util.faults import SliverDoesNotExist, UnknownSfaType
 from sfa.util.sfalogging import logger
-from sfa.storage.alchemy import dbsession
 from sfa.storage.model import RegRecord
 
 from sfa.managers.driver import Driver
@@ -310,7 +309,11 @@ class IotlabDriver(Driver):
         :rtype: RegUser
 
         """
-        return dbsession.query(RegRecord).filter_by(hrn=hrn).first()
+        # xxx this method should not be static
+        from sfa.storage.alchemy import global_dbsession
+        return global_dbsession.query(RegRecord).filter_by(hrn=hrn).first()
+        # code should read instead (if this method was not static, that is)
+        #return self.api.dbsession().query(RegRecord).filter_by(hrn=hrn).first()
 
     def testbed_name(self):
         """