[sugar] [PATCH] sugar.presence.presenceservice: don't mix up local variable 'activity' and imported module 'activity'

Simon McVittie simon.mcvittie at collabora.co.uk
Tue May 8 11:28:31 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This fixes AttributeErrors when trying to share activities.

- ---
 sugar/presence/presenceservice.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sugar/presence/presenceservice.py b/sugar/presence/presenceservice.py
index f93c831..621a289 100644
- --- a/sugar/presence/presenceservice.py
+++ b/sugar/presence/presenceservice.py
@@ -27,7 +27,9 @@ import logging
 # import), that would read as:
 #   from . import buddy, activity 
 # see PEP: http://docs.python.org/whatsnew/pep-328.html
- -import buddy, activity
+
+import buddy
+from activity import Activity
 
 
 DBUS_SERVICE = "org.laptop.Sugar.Presence"
@@ -158,7 +160,7 @@ class PresenceService(gobject.GObject):
                 obj = buddy.Buddy(self._bus, self._new_object,
                         self._del_object, object_path)
             elif object_path.startswith(self._PS_ACTIVITY_OP):
- -                obj = activity.Activity(self._bus, self._new_object,
+                obj = Activity(self._bus, self._new_object,
                         self._del_object, object_path)
                 try:
                     # Pre-fill the activity's ID
@@ -353,7 +355,7 @@ class PresenceService(gobject.GObject):
 
         # Ensure the activity is not already shared/joined
         for obj in self._objcache.values():
- -            if not isinstance(object, activity.Activity):
+            if not isinstance(object, Activity):
                 continue
             if obj.props.id == actid or obj.props.joined:
                 raise RuntimeError("Activity %s is already shared." % actid)
- -- 
1.5.1.3

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFGQJceWSc8zVUw7HYRApLbAKDFcvzSDRkXSuyB8HOojbv2aWqVVQCgr7jW
IO9JA1PoD7mLGM9FyXLtgok=
=PDAP
-----END PGP SIGNATURE-----


More information about the Sugar mailing list