]> git.phdru.name Git - bookmarks_db.git/blobdiff - Storage/bkmk_stflad.py
Fix(Py3): Stop using module `string`
[bookmarks_db.git] / Storage / bkmk_stflad.py
index 156e956f7244fdc09809646917d12a707d6821d7..a4634fa8bc9a29617bb63358622baaaed6c3783d 100644 (file)
@@ -12,7 +12,6 @@ __license__ = "GNU GPL"
 __all__ = ['storage_flad']
 
 
-import string
 from m_lib.flad import fladm
 from bkmk_objects import Folder, Bookmark, Ruler, Walker
 
@@ -24,8 +23,8 @@ class storage_flad(Walker):
         self.first_object = 1
 
     def root_folder(self, f):
-        header = string.replace(f.header, ".", ".\n")
-        header = string.replace(header, "<", "\n<", 3)[1:]
+        header = f.header.replace(".", ".\n")
+        header = header.replace("<", "\n<", 3)[1:]
         header_file = open("header", 'w')
         header_file.write(header + "\n")
         header_file.write('<H1>%s</H1>\n\n' % f.name)
@@ -88,10 +87,10 @@ Charset: %s
         header = header_file.read()
         header_file.close()
 
-        header = string.split(header, "\n")
-        root_folder.header = string.join(header[:5], '')
+        header = header.split("\n")
+        root_folder.header = header[:5].join('')
         root_folder.name = header[5][4:-5]
-        root_folder.comment = string.join(header[7:], '')[4:]
+        root_folder.comment = header[7:].join('')[4:]
 
         save_level = 0
         got_folder = 1  # Start as if we already have one folder
@@ -112,9 +111,9 @@ Charset: %s
 
             save_level = level
             # Test here to save got_folder for next loop
-            got_folder = record.has_key("Folder")
+            got_folder = "Folder" in record
 
-            if record.has_key("URL"):
+            if "URL" in record:
                 comment = record["Comment"].replace("\\n", '\n')
                 bookmark = Bookmark(
                     record["URL"], record["AddDate"],
@@ -123,7 +122,7 @@ Charset: %s
                 bookmark.name = record["Title"]
                 self.current_folder.append(bookmark)
 
-            elif record.has_key("Folder"):
+            elif "Folder" in record:
                 folder = Folder(
                     record["AddDate"], record["Comment"],
                     record["LastModified"]
@@ -133,7 +132,7 @@ Charset: %s
                 self.folder_stack.append(folder)
                 self.current_folder = folder
 
-            elif record.has_key("Ruler"):
+            elif "Ruler" in record:
                 self.current_folder.append(Ruler())
 
             else: