X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Writers%2Fbkmk_wflad.py;h=cae46bb44554c1e79a54a32bd1d1ac72e80ab307;hb=e5a4bfbed97d95fd2a658d6dde003b5af154d95d;hp=11cd1436b398a18fbf77d664a59c30d51b01de87;hpb=c88cb7a75e7caf1d67466cfa107981d95115fa0c;p=bookmarks_db.git diff --git a/Writers/bkmk_wflad.py b/Writers/bkmk_wflad.py index 11cd143..cae46bb 100644 --- a/Writers/bkmk_wflad.py +++ b/Writers/bkmk_wflad.py @@ -4,7 +4,7 @@ This file is a part of Bookmarks database and Internet robot. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design" +__copyright__ = "Copyright (C) 2000-2023 PhiloSoft Design" __license__ = "GNU GPL" __all__ = ['writer_flad'] @@ -12,12 +12,13 @@ __all__ = ['writer_flad'] import time from bkmk_objects import Writer +from compat import unicode def strftime(s): try: return time.strftime("%a %d %b %Y %T", time.localtime(int(s))) - except (TypeError, ValueError): # s is None or is already formatted + except (TypeError, ValueError): # s is None or is already formatted return s @@ -30,36 +31,45 @@ class writer_flad(Writer): def start_folder(self, f, level): self.outfile.write(""" - Level: %d - Folder: %s - AddDate: %s - Comment: %s - LastModified: %s - """ % (level, f.name, strftime(f.add_date), f.comment, strftime(f.last_modified))) +Level: %d +Folder: %s +AddDate: %s +Comment: %s +LastModified: %s +""" % ( + level, f.name, strftime(f.add_date), f.comment, + strftime(f.last_modified)) + ) def bookmark(self, b, level): self.outfile.write(""" - Level: %d - Title: %s - URL: %s - AddDate: %s - LastVisit: %s - LastModified: %s - Keyword: %s - Comment: %s""" % (level+1, b.name, b.href, strftime(b.add_date), strftime(b.last_visit), strftime(b.last_modified), b.keyword, b.comment)) - - for attr_name, attr_out in (("error", "Error"), ("no_error", "NoError"), - ("moved", "Moved"), ("size", "Size"), ("md5", "Md5"), - ("real_title", "RealTitle"), ("test_time", "TestTime"), - ("icon_href", "IconURI"), ("icon", "Icon"), ("charset", "Charset")): +Level: %d +Title: %s +URL: %s +AddDate: %s +LastVisit: %s +LastModified: %s +Keyword: %s +Comment: %s""" % ( + level+1, b.name, b.href, strftime(b.add_date), + strftime(b.last_visit), strftime(b.last_modified), + b.keyword, b.comment) + ) + + for attr_name, attr_out in ( + ("error", "Error"), ("no_error", "NoError"), + ("moved", "Moved"), ("size", "Size"), ("md5", "Md5"), + ("real_title", "RealTitle"), ("test_time", "TestTime"), + ("icon_href", "IconURI"), ("icon", "Icon"), ("charset", "Charset"), + ): if hasattr(b, attr_name): value = getattr(b, attr_name) - if isinstance(value, unicode): - value = value.encode('utf-8') + #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")))) + self.outfile.write("\nLastTested: %s" % strftime(b.last_tested)) self.outfile.write("\n")