[Sugar-devel] Replacing Illegal character ':' in username (SL #2152)

Dipankar Patro dipankar at seeta.in
Wed Sep 29 13:32:22 EDT 2010


With reference to bug : http://bugs.sugarlabs.org/ticket/2152

I am trying to replace the ':' character in the username with '_', while the
user is entering the Username in About Me.

The following has been done by me so far:
diff --git a/extensions/cpsection/aboutme/model.py
index 8500799..47e7158 100644
--- a/extensions/cpsection/aboutme/model.py
+++ b/extensions/cpsection/aboutme/model.py
@@ -17,6 +17,7 @@

 from gettext import gettext as _
 import gconf
+import re

 _COLORS = {'red': {'dark':'#b20008', 'medium':'#e6000a',
            'orange': {'dark':'#9a5200', 'medium':'#c97e00',
@@ -42,6 +43,7 @@ def set_nick(nick):
     if not nick:
         raise ValueError(_("You must enter a name."))
     if not isinstance(nick, unicode):
+        nick = re.sub(r':', '_', nick)
         nick = unicode(nick, 'utf-8')
     client = gconf.client_get_default()
     client.set_string("/desktop/sugar/user/nick", nick)
I need some feedback on this.

Also I am trying to put a check at boot up so that any 'nick' /username
having ':' can be rectified at startup itself. I have tracked  down the file

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100929/faf090da/attachment.htm 

More information about the Sugar-devel mailing list