]
-import os, cgi
-BKMK_FORMAT = os.environ.get("BKMK_FORMAT", "MOZILLA")
+import os
+BKMK_FORMAT = os.environ.get("BKMK_FORMAT", "MOZILLA")
class Folder(list):
isFolder = 1
def __init__(self, href, add_date, last_visit=None, last_modified=None,
keyword=None, comment='', icon_href=None, icon=None, charset=None):
+ if isinstance(href, str):
+ try:
+ href = href.decode('idna')
+ except UnicodeDecodeError: # Non-ascii href
+ href = href.decode('utf-8')
+ elif not isinstance(href, unicode):
+ raise TypeError("Bookmark's href must be str or unicode, not %r" % type(href))
self.href = href
self.add_date = add_date
self.last_visit = last_visit