[Sugar-devel] [PATCH sugar] Intro: Fall back to user name if GECOS real name field is empty
Sascha Silbe
silbe at activitycentral.com
Sat Feb 12 12:15:02 EST 2011
Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
I'd like to offer this version instead. It eliminates the now superflous
check on pw_gecos, too.
src/jarabe/intro/window.py | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py
index a18a0d2..e64d46b 100644
--- a/src/jarabe/intro/window.py
+++ b/src/jarabe/intro/window.py
@@ -172,13 +172,9 @@ class _IntroBox(hippo.CanvasBox):
self._page = self.PAGE_COLOR
if default_nick == 'system':
pwd_entry = pwd.getpwuid(os.getuid())
- if pwd_entry.pw_gecos:
- nick = pwd_entry.pw_gecos.split(',')[0]
- self._name_page.set_name(nick)
- else:
- self._name_page.set_name(pwd_entry.pw_name)
- else:
- self._name_page.set_name(default_nick)
+ default_nick = (pwd_entry.pw_gecos.split(',')[0] or
+ pwd_entry.pw_name)
+ self._name_page.set_name(default_nick)
self._setup_page()
--
1.7.2.3
More information about the Sugar-devel
mailing list