From: Oleg Broytman Date: Sun, 1 Aug 2010 20:18:44 +0000 (+0000) Subject: Fixed bugs in loading folders. X-Git-Tag: v4.5.3~140 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=70c4014812c5406cd7e675dbf6af95eaaeb7e04d;hp=d6df0463571e57111c1855ed97ebdea90a3142d2;p=bookmarks_db.git Fixed bugs in loading folders. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@236 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Storage/bkmk_stjson.py b/Storage/bkmk_stjson.py index 85eb84c..cd6139f 100644 --- a/Storage/bkmk_stjson.py +++ b/Storage/bkmk_stjson.py @@ -99,6 +99,9 @@ class storage_json(Walker): root_folder = Folder() root_folder.header = '' + root_folder.add_date = bookmarks_dict["dateAdded"] + root_folder.comment = '' + root_folder.last_modified = bookmarks_dict["lastModified"] self.folder_stack = [root_folder] self.current_folder = root_folder @@ -108,28 +111,21 @@ class storage_json(Walker): return root_folder - def load_folder(self, folder, _dict): - if _dict["type"] != "text/x-moz-place-container": + def load_folder(self, folder, fdict): + if fdict["type"] != "text/x-moz-place-container": raise ValueError("Root object is not a Mozilla container") - folder.id = _dict["id"] - folder.index = _dict.get("index") - folder.parent_idx = _dict.get("parent") + folder.id = fdict["id"] + folder.index = fdict.get("index") + folder.parent_idx = fdict.get("parent") + folder.name = encode(fdict["title"]) - folder.name = encode(_dict["title"]) - folder.comment = '' - folder.add_date = _dict["dateAdded"] - folder.last_modified = _dict["lastModified"] - - for record in _dict["children"]: + for record in fdict["children"]: if record["type"] == "text/x-moz-place-container": folder = Folder( add_date=record["dateAdded"], comment=get_comment(record.get("annos")), last_modified=record["lastModified"]) - folder.id = record["id"] - folder.parent_idx = record["parent"] - folder.name = encode(record["title"]) self.current_folder.append(folder) self.folder_stack.append(folder) self.current_folder = folder