From d2bac711f96ff10cd40201bdfe7810f0fe0f872e Mon Sep 17 00:00:00 2001
From: Sascha Silbe <sascha@silbe.org>
Date: Tue, 18 Aug 2009 15:25:13 +0200
Subject: [PATCH] compatible changes to prepare for version support

---
 src/sugar/activity/activity.py        |    6 +++---
 src/sugar/activity/activityfactory.py |    2 +-
 src/sugar/activity/activityhandle.py  |    2 --
 src/sugar/datastore/__init__.py       |   29 +++++++++++++++++++++++++++++
 src/sugar/graphics/objectchooser.py   |    2 +-
 5 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index f20d402..1c2e06a 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -470,7 +470,7 @@ class Activity(Window, gtk.Container):
         """
         raise NotImplementedError
 
-    def __save_cb(self):
+    def __save_cb(self, object_id=None):
         logging.debug('Activity.__save_cb')
         self._updating_jobject = False
         if self._quit_requested:
@@ -550,7 +550,7 @@ class Activity(Window, gtk.Container):
             logging.debug('Cannot save, no journal object.')
             return
 
-        logging.debug('Activity.save: %r' % self._jobject.object_id)
+        logging.debug('Activity.save: %r', self._jobject.object_id)
 
         if self._updating_jobject:
             logging.info('Activity.save: still processing a previous request.')
@@ -594,7 +594,7 @@ class Activity(Window, gtk.Container):
         Activities should not override this method. Instead, like save() do any
         copy work that needs to be done in write_file()
         """
-        logging.debug('Activity.copy: %r' % self._jobject.object_id)
+        logging.debug('Activity.copy: %r', self._jobject.object_id)
         self.save()
         self._jobject.object_id = None
 
diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
index 462a0f9..3d790c7 100644
--- a/src/sugar/activity/activityfactory.py
+++ b/src/sugar/activity/activityfactory.py
@@ -319,7 +319,7 @@ class ActivityCreationHandler(gobject.GObject):
     def _find_object_reply_handler(self, jobjects, count):
         if count > 0:
             if count > 1:
-                logging.debug("Multiple objects has the same activity_id.")
+                logging.debug("Multiple objects have the same activity_id.")
             self._handle.object_id = jobjects[0]['uid']
         self._launch_activity()
 
diff --git a/src/sugar/activity/activityhandle.py b/src/sugar/activity/activityhandle.py
index f255fd5..c4e16a8 100644
--- a/src/sugar/activity/activityhandle.py
+++ b/src/sugar/activity/activityhandle.py
@@ -38,8 +38,6 @@ class ActivityHandle(object):
             since new activities does not have an 
             associated object (yet).
             
-            XXX Not clear how this relates to the activity
-            id yet, i.e. not sure we really need both. TBF
         uri -- URI associated with the activity. Used when 
             opening an external file or resource in the 
             activity, rather than a journal object 
diff --git a/src/sugar/datastore/__init__.py b/src/sugar/datastore/__init__.py
index bdb658b..ece8f20 100644
--- a/src/sugar/datastore/__init__.py
+++ b/src/sugar/datastore/__init__.py
@@ -14,3 +14,32 @@
 # License along with this library; if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
+
+
+class NoSpaceLeftError(Exception):
+    """There is not enough space left on disk to safely store data and/or
+    metadata.
+
+    Operation aborted, everything still at the previous state.
+    """
+
+class InvalidArgumentError(Exception):
+    """One or several of the passed parameters were invalid.
+
+    See formatted string for details. This should only happen if the caller
+    is doing something wrong, not during normal operation.
+    """
+
+class CorruptionError(Exception):
+    """The internal data structures of the data store or one of its backends
+    are corrupted.
+
+    Should only happen in case of hardware defects or OS bugs.
+    """
+
+class BusyError(Exception):
+    """Data store is busy recovering from a crash.
+
+    Please wait for Ready() before starting to issue any API call (except
+    check_ready()).
+    """
diff --git a/src/sugar/graphics/objectchooser.py b/src/sugar/graphics/objectchooser.py
index fb3703d..ef4e728 100644
--- a/src/sugar/graphics/objectchooser.py
+++ b/src/sugar/graphics/objectchooser.py
@@ -110,7 +110,7 @@ class ObjectChooser(object):
     def __chooser_response_cb(self, chooser_id, object_id):
         if chooser_id != self._chooser_id:
             return
-        logging.debug('ObjectChooser.__chooser_response_cb: %r' % object_id)
+        logging.debug('ObjectChooser.__chooser_response_cb: %r', object_id)
         self._response_code = gtk.RESPONSE_ACCEPT
         self._object_id = object_id
         self._cleanup()
-- 
1.6.3.3

