]> git.phdru.name Git - bookmarks_db.git/blobdiff - Storage/bkmk_stpickle.py
Version 3.3.1.
[bookmarks_db.git] / Storage / bkmk_stpickle.py
diff --git a/Storage/bkmk_stpickle.py b/Storage/bkmk_stpickle.py
new file mode 100644 (file)
index 0000000..2ed61d3
--- /dev/null
@@ -0,0 +1,31 @@
+"""
+   Bookmarks storage manager - pickle; certainly the most simple and elegant :)
+
+   Written by BroytMann, Feb 2000 - Mar 2000. Copyright (C) 2000 PhiloSoft Design
+"""
+
+
+try:
+   import cPickle
+   pickle = cPickle
+
+except ImportError:
+   import pickle
+
+
+class storage_pickle:
+   filename = "bookmarks_db.pickle"
+
+
+   def store(self, root_folder):
+      outfile = open(self.filename, 'wb')
+      pickle.dump(root_folder, outfile, 1)
+      outfile.close()
+
+
+   def load(self):
+      infile = open(self.filename, 'rb')
+      root_folder = pickle.load(infile)
+      infile.close()
+
+      return root_folder