From 9d05b2e0a76e5de74790fe44a991392e50fdb67c Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Mon, 16 Jul 2007 11:59:54 -0400 Subject: [PATCH] Console: fix reading end byte of text files (by dcbw) --- services/console/interface/xo/system.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/console/interface/xo/system.py b/services/console/interface/xo/system.py index d057dcb1..917142e5 100644 --- a/services/console/interface/xo/system.py +++ b/services/console/interface/xo/system.py @@ -33,7 +33,7 @@ class XO_System(gtk.Fixed): table.set_row_spacings(7) # BUILD - build = self._read_file('/boot/olpc_build').split('\n')[0] + build = self._read_file('/boot/olpc_build') label_build = Label('OLPC Build:', Label.DESCRIPTION) label_build_value = Label(str(build), Label.DESCRIPTION) @@ -44,12 +44,12 @@ class XO_System(gtk.Fixed): Label.DESCRIPTION) # FIRMWARE - firmware = self._read_file('/ofw/ec-name').split('\n')[0] + firmware = self._read_file('/ofw/ec-name') label_firmware = Label('XO Firmware:', Label.DESCRIPTION) label_firmware_value = Label(firmware, Label.DESCRIPTION) # SERIAL NUMBER - serial = self._read_file('/ofw/serial-number').split('\n')[0] + serial = self._read_file('/ofw/serial-number') label_serial = Label('XO Serial Number:', Label.DESCRIPTION) label_serial_value = Label(serial, Label.DESCRIPTION) @@ -83,6 +83,9 @@ class XO_System(gtk.Fixed): value = f.read() f.close() + value = value.split('\n')[0] + if value[len(value) - 1] == '\x00': + value = value[:len(value) - 1] return value except: return "None"