First, when the attribute exists, it will always interpret the size in kilobytes since it ignores the type in the split. Instead, you should use the string_to_type function defined in checkbox.lib.conversion.
Second, when the attribute doesn't exist, the split() method will fail horribly on a None value. So, I would suggest you write the size property method like this, remembering to import string_to_type at the beginning of the module of course:
In checkbox.lib.dmi, you added:
+ @property lower() s.get(attribute ) split() [0]) * 1024
+ def size(self):
+ attribute = "%s_size" % self.category.
+ size = self._attribute
+
+ size = int(size.
+
+ if size:
+ return size
+
+ return None
First, when the attribute exists, it will always interpret the size in kilobytes since it ignores the type in the split. Instead, you should use the string_to_type function defined in checkbox. lib.conversion.
Second, when the attribute doesn't exist, the split() method will fail horribly on a None value. So, I would suggest you write the size property method like this, remembering to import string_to_type at the beginning of the module of course:
+ @property lower() s.get(attribute ) to_type( size)
+ def size(self):
+ attribute = "%s_size" % self.category.
+ size = self._attribute
+ if size:
+ size = string_
+
+ return size
Still in checkbox.lib.dmi, you added:
+ @property lower() s.get(attribute )
+ def form(self):
+ attribute = "%s_form" % self.category.
+ form = self._attribute
+
+ if form:
+ return form
+
+ return None
This could be expressed more simply as:
+ @property lower() s.get(attribute )
+ def form(self):
+ attribute = "%s_form" % self.category.
+ return self._attribute
Other than that, the changes look good. After you make these changes, I'll have another look but I think we'll be good to merge. Thanks!