Development Team/Almanac/sugar.profile: Difference between revisions

No edit summary
 
(5 intermediate revisions by 4 users not shown)
Line 16: Line 16:


client = gconf.client_get_default()
client = gconf.client_get_default()
username = client.get_string("/desktop/suagr/user/nick")
username = client.get_string("/desktop/sugar/user/nick")
</pre>
</pre>


Line 27: Line 27:
         prof = profile.get_profile()
         prof = profile.get_profile()


         # Two ways to print nickname: either through profile object, or through a helper funciton in sugar.profile
         # Two ways to print nickname: either through profile object, or through a helper function in sugar.profile
         print prof.nick_name
         print prof.nick_name
         print profile.get_nick_name()
         print profile.get_nick_name()
Line 73: Line 73:
=== How do I get the school server with which this child is associated? ===
=== How do I get the school server with which this child is associated? ===


Method on the 82: DEPRECATED
<pre>
<pre>
from sugar import profile
from sugar import profile
Line 83: Line 84:
         #Print out whether this XO is actually registered with a school server
         #Print out whether this XO is actually registered with a school server
         print prof.jabber_registered
         print prof.jabber_registered
</pre>
Get school server with both older and new implementations.
<pre>
from sugar import profile
...
        prof = profile.get_profile()
        jabber_serv = None
        if hasattr(profile, 'jabber_server'):
            jabber_serv = profile.jabber_server
        else:
            import gconf
            client = gconf.client_get_default()
            jabber_serv = client.get_string("/desktop/sugar/collaboration/jabber_server")
</pre>
</pre>