Minor code cleanup
authorDavid Stainton <dstainton415@gmail.com>
Wed, 3 Jun 2015 17:35:28 +0000 (10:35 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:21 +0000 (16:45 +0100)
src/allmydata/client.py

index 90f25eeac82887848e3f9ba5cee459d3eee43187..ab06cfb0490155761396c6bce0f36df8325976d4 100644 (file)
@@ -507,10 +507,9 @@ class Client(node.Node, pollmixin.PollMixin):
                 dbfile = os.path.join(self.basedir, "private", "magicfolderdb.sqlite")
                 dbfile = abspath_expanduser_unicode(dbfile)
 
-                magic_folder_parent_dircap = os.path.join(self.basedir, "private", "magic_folder_parent_dircap")
-                magic_folder_parent_dircap = abspath_expanduser_unicode(magic_folder_parent_dircap)
-                fh = open(magic_folder_parent_dircap, "r")
-                parent_dircap = fh.read().strip()
+                parent_dircap_path = os.path.join(self.basedir, "private", "magic_folder_parent_dircap")
+                parent_dircap_path = abspath_expanduser_unicode(magic_folder_parent_dircap)
+                parent_dircap = fileutil.read(parent_dircap_path).strip()
 
                 s = drop_upload.DropUploader(self, upload_dircap, parent_dircap, local_dir, dbfile)
                 s.setServiceParent(self)