comparison src/tools/sqlite.py @ 416:32dc8b18c2ae

core: param loading/purging on profile connection/disconnection - fixed default value in .*getParam.*
author Goffi <goffi@goffi.org>
date Tue, 01 Nov 2011 22:59:15 +0100
parents dd4caab17008
children acd908528ef7
comparison
equal deleted inserted replaced
415:3348331e0f09 416:32dc8b18c2ae
112 def fillParams(result): 112 def fillParams(result):
113 for param in result: 113 for param in result:
114 category,name,value = param 114 category,name,value = param
115 params_ind[profile][(category, name)] = value 115 params_ind[profile][(category, name)] = value
116 debug(_("loading individual parameters from database")) 116 debug(_("loading individual parameters from database"))
117 d = self.dbpool.runQuery("SELECT category,name,value FROM param_gen WHERE profile_id=?", self.profiles[profile]) 117 d = self.dbpool.runQuery("SELECT category,name,value FROM param_ind WHERE profile_id=?", (self.profiles[profile],))
118 d.addCallback(fillParams) 118 d.addCallback(fillParams)
119 return d 119 return d
120 120
121 def getIndParam(self, category, name, profile): 121 def getIndParam(self, category, name, profile):
122 """Ask database for the value of one specific individual parameter 122 """Ask database for the value of one specific individual parameter
153 ##Helper methods## 153 ##Helper methods##
154 154
155 def __getFirstResult(self, result): 155 def __getFirstResult(self, result):
156 """Return the first result of a database query 156 """Return the first result of a database query
157 Useful when we are looking for one specific value""" 157 Useful when we are looking for one specific value"""
158 return "" if not result else result[0][0] 158 return None if not result else result[0][0]