# you can overide this for fancy default handling
def load(self):
- if self.saved_value is None:
+ sv = self.saved_value
+ if sv is None:
self.value = self.default
else:
- self.value = self.fromstring(self.saved_value)
+ self.value = self.fromstring(sv)
def tostring(self, value):
return str(value)
self.load()
def isChanged(self):
- if self.saved_value is None and self.value == self.default:
+ sv = self.saved_value
+ if sv is None and self.value == self.default:
return False
- return self.tostring(self.value) != self.saved_value
+ return self.tostring(self.value) != sv
def changed(self):
for x in self.notifiers:
return eval(val)
def load(self):
- if self.saved_value is None:
+ sv = self.saved_value
+ if sv is None:
tmp = self.default
else:
- tmp = self.fromstring(self.saved_value)
+ tmp = self.fromstring(sv)
self.locations = [[x, None, False, False] for x in tmp]
self.refreshMountpoints()
for x in self.locations:
self.saved_value = self.tostring([x[0] for x in self.locations])
def isChanged(self):
- if self.saved_value is None and self.locations == []:
+ sv = self.saved_value
+ if val is None and self.locations == []:
return False
- return self.tostring([x[0] for x in self.locations]) != self.saved_value
+ return self.tostring([x[0] for x in self.locations]) != sv
def mountpointsChanged(self, action, dev):
print "Mounts changed: ", action, dev
self[int(key)].saved_value = val
saved_value = property(getSavedValue, setSavedValue)
-
+
def append(self, item):
i = str(len(self))
list.append(self, item)
def getSavedValue(self):
res = {}
for (key, val) in self.items():
- if val.saved_value is not None:
- res[str(key)] = val.saved_value
+ sv = val.saved_value
+ if sv is not None:
+ res[str(key)] = sv
return res
def setSavedValue(self, values):
def getSavedValue(self):
res = self.content.stored_values
for (key, val) in self.content.items.items():
- if val.saved_value is not None:
- res[key] = val.saved_value
+ sv = val.saved_value
+ if sv is not None:
+ res[key] = sv
elif key in res:
del res[key]
-
return res
def setSavedValue(self, values):