git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@345
fdd5c36f-1aea-0310-aeeb-
c58d7e2b6c23
folder.index = fdict.get("index")
folder.parent_idx = fdict.get("parent")
folder.root = fdict.get("root")
folder.index = fdict.get("index")
folder.parent_idx = fdict.get("parent")
folder.root = fdict.get("root")
- folder.name = encode(fdict["title"])
+ folder.name = encode_title(fdict["title"])
for record in fdict["children"]:
if record["type"] == "text/x-moz-place-container":
for record in fdict["children"]:
if record["type"] == "text/x-moz-place-container":
elif record["type"] == "text/x-moz-place":
bookmark = Bookmark(
elif record["type"] == "text/x-moz-place":
bookmark = Bookmark(
+ href=record["uri"].encode('utf-8'),
add_date=record.get("dateAdded"),
last_modified=record.get("lastModified"),
add_date=record.get("dateAdded"),
last_modified=record.get("lastModified"),
- keyword=record.get("keyword"),
+ keyword=get_str(record, "keyword"),
comment=get_comment(record.get("annos")),
comment=get_comment(record.get("annos")),
- charset=record.get("charset"))
+ charset=get_str(record, "charset"))
bookmark.id = record["id"]
bookmark.index = record.get("index")
bookmark.parent_idx = record["parent"]
bookmark.id = record["id"]
bookmark.index = record.get("index")
bookmark.parent_idx = record["parent"]
- bookmark.name = encode(record["title"])
+ bookmark.name = encode_title(record["title"])
self.current_folder.append(bookmark)
elif record["type"] == "text/x-moz-place-separator":
self.current_folder.append(bookmark)
elif record["type"] == "text/x-moz-place-separator":
ruler.index = record["index"]
ruler.last_modified = record["lastModified"]
ruler.parent_idx = record["parent"]
ruler.index = record["index"]
ruler.last_modified = record["lastModified"]
ruler.parent_idx = record["parent"]
- ruler.name = encode(record["title"])
+ ruler.name = encode_title(record["title"])
ruler.comment = get_comment(record.get("annos"))
self.current_folder.append(ruler)
ruler.comment = get_comment(record.get("annos"))
self.current_folder.append(ruler)
else:
self.current_folder = None
else:
self.current_folder = None
+def encode_title(title):
return title.encode("UTF-8", "xmlcharrefreplace")
return title.encode("UTF-8", "xmlcharrefreplace")
+def get_str(record, name):
+ if name in record:
+ return record[name].encode('utf-8')
+ return ''
+
def get_comment(annos):
if not annos:
return ''
def get_comment(annos):
if not annos:
return ''