"""
Parser for Netscape Navigator's and Mozilla's bookmarks.html
- Written by BroytMann. Copyright (C) 1997-2004 PhiloSoft Design
+ Written by BroytMann. Copyright (C) 1997-2007 PhiloSoft Design
"""
else:
global DEFAULT_CHARSET
DEFAULT_CHARSET = sys.getdefaultencoding()
+ if DEFAULT_CHARSET == "ascii":
+ try:
+ import locale
+ except ImportError:
+ pass
+ else:
+ DEFAULT_CHARSET = locale.getpreferredencoding()
def start_title(self, attrs):
+ if DEFAULT_CHARSET:
+ self.accumulator += '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%s">\n' % DEFAULT_CHARSET
self.accumulator += "<TITLE>"
def end_title(self):
# Start a folder
def start_h3(self, attrs):
+ last_modified = None
for attrname, value in attrs:
value = value.strip()
if attrname == 'add_date':
add_date = value
+ elif attrname == 'last_modified':
+ last_modified = value
debug("New folder...")
- folder = Folder(add_date)
+ folder = Folder(add_date, last_modified=last_modified)
self.current_object = folder
self.current_folder.append(folder)
self.folder_stack.append(folder) # push new folder