[Pkg-sugar-commit] [sugar-toolkit] 53/118: To emulate missed parts of DSObject - optional file_path removing #1241

Jonas Smedegaard dr at jones.dk
Thu Apr 16 18:49:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.84.10-1
in repository sugar-toolkit.

commit 5ebfbd06c1d96aa8124294090dd02eaab5b70bb3
Author: Aleksey Lim <alsroot at member.fsf.org>
Date:   Fri Sep 18 10:31:13 2009 +0000

    To emulate missed parts of DSObject - optional file_path removing #1241
---
 src/sugar/datastore/datastore.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
index d84a7f4..d174bd4 100644
--- a/src/sugar/datastore/datastore.py
+++ b/src/sugar/datastore/datastore.py
@@ -168,6 +168,7 @@ class RawObject(object):
     def get_file_path(self, fetch=True):
         # we have to create symlink since its a common practice
         # to create hardlinks to jobject files
+        # and w/o this, it wouldn't work since we have file from mounted device
         if self._file_path is None:
             self._file_path = tempfile.mktemp(
                     prefix='rawobject',
@@ -183,7 +184,8 @@ class RawObject(object):
             return
         self._destroyed = True
         if self._file_path is not None:
-            os.remove(self._file_path)
+            if os.path.exists(self._file_path):
+                os.remove(self._file_path)
             self._file_path = None
 
     def __del__(self):
@@ -194,11 +196,11 @@ class RawObject(object):
 
 def get(object_id):
     logging.debug('datastore.get')
-    metadata = dbus_helpers.get_properties(object_id)
 
     if object_id.startswith('/'):
         return RawObject(object_id)
 
+    metadata = dbus_helpers.get_properties(object_id)
     ds_object = DSObject(object_id, DSMetadata(metadata), None)
     # TODO: register the object for updates
     return ds_object

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git



More information about the pkg-sugar-commit mailing list