X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Writers%2Fbkmk_wflad.py;h=999872b1e488a93c062a3caa3514f0281da33439;hb=abee12cd1f9876c8a4e0d6dfbb854bbb118d01b8;hp=0a94fd8e93652d9727ddc270dcaf787093fad591;hpb=61f4f37267b4f5d200abc5e8cc278d8e946cff26;p=bookmarks_db.git diff --git a/Writers/bkmk_wflad.py b/Writers/bkmk_wflad.py index 0a94fd8..999872b 100644 --- a/Writers/bkmk_wflad.py +++ b/Writers/bkmk_wflad.py @@ -1,9 +1,14 @@ -""" - Dump bookmarks db to a more readable FLat Ascii Database +"""Dump bookmarks db to a more readable FLat Ascii Database - Written by Broytman. Copyright (C) 2000-2010 PhiloSoft Design. +This file is a part of Bookmarks database and Internet robot. """ +__author__ = "Oleg Broytman " +__copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +__license__ = "GNU GPL" + +__all__ = ['writer_flad'] + import time from bkmk_objects import Writer @@ -23,7 +28,6 @@ class writer_flad(Writer): Writer.__init__(self, outfile, prune) self.first_object = 1 - def start_folder(self, f, level): self.outfile.write(""" Level: %d @@ -31,8 +35,7 @@ Folder: %s AddDate: %s Comment: %s LastModified: %s -""" % (level, f.name, strftime(f.add_date), f.comment, f.last_modified or '')) - +""" % (level, f.name, strftime(f.add_date), f.comment, strftime(f.last_modified))) def bookmark(self, b, level): self.outfile.write(""" @@ -50,7 +53,10 @@ Comment: %s""" % (level+1, b.name, b.href, strftime(b.add_date), strftime(b.last ("real_title", "RealTitle"), ("test_time", "TestTime"), ("icon_href", "IconURI"), ("icon", "Icon"), ("charset", "Charset")): if hasattr(b, attr_name): - self.outfile.write("\n%s: %s" % (attr_out, getattr(b, attr_name))) + value = getattr(b, attr_name) + if isinstance(value, unicode): + value = value.encode('utf-8') + self.outfile.write("\n%s: %s" % (attr_out, value)) if hasattr(b, "last_tested"): self.outfile.write("\n%s: %s" % ("LastTested", strftime(getattr(b, "last_tested"))))