On Mon, Oct 17, 2011 at 09:23:18AM +0200, Simon Schampijer wrote: > def _parse_firmware_number(firmware_no): > if firmware_no is None: > firmware_no = _not_available > else: > # try to extract Open Firmware version from OLPC style > # version string, e.g. "CL2 Q4B11 Q4B" > fields = re.split(' +', firmware_no) > if len(fields) == 3: > firmware_no = fields[1] > return firmware_no
Again I disagree with this method, since it expects whitespace between fields, and OpenFirmware does not guarantee whitespace. Instead, you should extract byte positions. Skip six characters, then extract seven characters. Trim any trailing spaces from the result. Mitch and I discussed this during this last week. -- James Cameron http://quozl.linux.org.au/ _______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel