]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fixed bugs in loading folders.
authorOleg Broytman <phd@phdru.name>
Sun, 1 Aug 2010 20:18:44 +0000 (20:18 +0000)
committerOleg Broytman <phd@phdru.name>
Sun, 1 Aug 2010 20:18:44 +0000 (20:18 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@236 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Storage/bkmk_stjson.py

index 85eb84cc661f03319f0074007d33e8b30b915b0c..cd6139faa36c66afdaf65c57deb479e13e46b99f 100644 (file)
@@ -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