root_folder = Folder()
root_folder.header = ''
- root_folder.add_date = convert_date_from_json(bookmarks_dict["dateAdded"])
+ root_folder.add_date = convert_date_from_json(bookmarks_dict.get("dateAdded"))
root_folder.comment = ''
- root_folder.last_modified = convert_date_from_json(bookmarks_dict["lastModified"])
+ root_folder.last_modified = convert_date_from_json(bookmarks_dict.get("lastModified"))
self.folder_stack = [root_folder]
self.current_folder = root_folder
+ if "type" not in bookmarks_dict:
+ bookmarks_dict = bookmarks_dict["children"][0]
self.load_folder(root_folder, bookmarks_dict)
if self.folder_stack:
raise RuntimeError('Excessive folder stack: %s' % self.folder_stack)
for record in fdict["children"]:
if record["type"] == "text/x-moz-place-container":
folder = Folder(
- add_date=convert_date_from_json(record["dateAdded"]),
+ add_date=convert_date_from_json(record.get("dateAdded")),
comment=get_comment(record.get("annos")),
- last_modified=convert_date_from_json(record["lastModified"]))
+ last_modified=convert_date_from_json(record.get("lastModified")))
self.current_folder.append(folder)
self.folder_stack.append(folder)
self.current_folder = folder
charset=get_str(record, "charset"))
bookmark.id = record["id"]
bookmark.index = record.get("index")
- bookmark.parent_idx = record["parent"]
+ bookmark.parent_idx = record.get("parent")
bookmark.name = encode_title(record["title"])
self.current_folder.append(bookmark)
elif record["type"] == "text/x-moz-place-separator":
ruler = Ruler()
- ruler.add_date = convert_date_from_json(record["dateAdded"])
+ ruler.add_date = convert_date_from_json(record.get("dateAdded"))
ruler.id = record["id"]
ruler.index = record["index"]
- ruler.last_modified = convert_date_from_json(record["lastModified"])
- ruler.parent_idx = record["parent"]
+ ruler.last_modified = convert_date_from_json(record.get("lastModified"))
+ ruler.parent_idx = record.get("parent")
ruler.name = encode_title(record["title"])
ruler.comment = get_comment(record.get("annos"))
self.current_folder.append(ruler)