[Sugar-devel] [PATCH sugar] Do not allow empty default nicks

Aleksey Lim alsroot at activitycentral.org
Wed Feb 9 17:23:27 EST 2011


The problem might occure if long user name not empty but the first field
if empty.
---
 src/jarabe/intro/window.py |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py
index 3b34d23..143440d 100644
--- a/src/jarabe/intro/window.py
+++ b/src/jarabe/intro/window.py
@@ -168,12 +168,11 @@ class _IntroBox(hippo.CanvasBox):
             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)
+                    default_nick = pwd_entry.pw_gecos.split(',')[0] or \
+                            pwd_entry.pw_name
                 else:
-                    self._name_page.set_name(pwd_entry.pw_name)
-            else:
-                self._name_page.set_name(default_nick)
+                    default_nick = pwd_entry.pw_name
+            self._name_page.set_name(default_nick)
 
         self._setup_page()
 
-- 
1.7.3.4



More information about the Sugar-devel mailing list