[Sugar-devel] [PATCH /sugar-jhbuild/source/sugar/extensions/cpsection/aboutme/model.py] Trim white space in username

Jordan Homan xjord89x at gmail.com
Thu Feb 24 15:01:39 EST 2011


 
 def set_nick(nick):
+    print "Got into set_nick method"
     """Set the nickname.
     nick : e.g. 'walter'
     """
@@ -49,6 +50,15 @@
     if not isinstance(nick, unicode):
         nick = unicode(nick, 'utf-8')
     client = gconf.client_get_default()
+    nickLen = 0
+    isMultiLine = False
+    while ((nickLen < len(nick)) and (not isMultiLine)):
+        newLine = nick[nickLen]
+	if newLine == "\n":
+	    isMultiLine = True
+        nickLen = nickLen +1   
+    if not isMultiLine:
+        nick = nick.strip()
     client.set_string('/desktop/sugar/user/nick', nick)
     return 1
 
@@ -123,3 +133,4 @@
     client = gconf.client_get_default()
     client.set_string('/desktop/sugar/user/color', color)
     return 1
+


More information about the Sugar-devel mailing list