Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/profile.py
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-02-25 22:53:10 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-02-25 22:53:10 (GMT)
commit1f91f7f7afd34143721ac66936546e4444950369 (patch)
tree118bd73930190a901beed3809e31a73a2550bf28 /sugar/profile.py
parent32a92a8c11631c0b5117fcbaa2c2b73ded11a8b3 (diff)
New intro/setup screen
Diffstat (limited to 'sugar/profile.py')
-rw-r--r--sugar/profile.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/sugar/profile.py b/sugar/profile.py
index cb1309b..43f3657 100644
--- a/sugar/profile.py
+++ b/sugar/profile.py
@@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
+import logging
from ConfigParser import ConfigParser
from sugar import env
@@ -41,11 +42,33 @@ class _Profile(object):
if cp.has_option('Buddy', 'Color'):
self.color = XoColor(cp.get('Buddy', 'Color'))
- if cp.has_option('Buddy', 'PublicKey'):
- self.pubkey = cp.get('Buddy', 'PublicKey')
-
del cp
+ self._load_pubkey()
+
+ def _load_pubkey(self):
+ self.pubkey = None
+
+ key_path = os.path.join(env.get_profile_path(), 'owner.key.pub')
+ try:
+ f = open(key_path, "r")
+ lines = f.readlines()
+ f.close()
+ except IOError, e:
+ logging.error("Error reading public key: %s" % e)
+ return
+
+ magic = "ssh-dss "
+ for l in lines:
+ l = l.strip()
+ if not l.startswith(magic):
+ continue
+ self.pubkey = l[len(magic):]
+ break
+ if not self.pubkey:
+ logging.error("Error parsing public key.")
+
+
def get_nick_name():
return _profile.name