def isWritable(self, name):
     value = self._connection.fetchOne(
         'SELECT writable FROM PROPERTIES WHERE name=?', (name, ))
     if value.success():
         return Result(True, True if value.content[0] == 1 else False)
     else:
         return Result(False, None)
 def findAll(self):
     properties = {}
     fetchresult = self._connection.fetchAll(
         'SELECT name, value, writable FROM PROPERTIES ORDER BY name')
     if fetchresult.success:
         with closing(fetchresult.content) as cursor:
             for record in cursor:
                 properties[record[0]] = (record[1],
                                          True if record[2] == 1 else False)
     return Result(True, properties)
Beispiel #3
0
 def list(self):
     return Result(True, list(self._values.keys()))
Beispiel #4
0
 def clear(self):
     self._values = {}
     return Result(True, list(self._values.keys()))
Beispiel #5
0
 def unselect(self):
     cle = list(self._values.keys())[-1]
     self._values.pop(cle)
     return Result(True, list(self._values.keys()))
Beispiel #6
0
 def select(self, number):
     self._values[number] = number
     return Result(True, list(self._values.keys()))
 def unset(self, name):
     if self.isWritable(name):
         return self.uncheckedUnset(name)
     else:
         return Result(False, None)
 def set(self, name, value):
     writable = self.isWritable(name)
     if writable.success() and writable.content:
         return self.uncheckedSet(name, value, True)
     else:
         return Result(False, None)