]> git.phdru.name Git - bookmarks_db.git/blob - Storage/bkmk_stpickle.py
Added __all__.
[bookmarks_db.git] / Storage / bkmk_stpickle.py
1 """Bookmarks storage manager - pickle; certainly the most simple and elegant :)
2
3 This file is a part of Bookmarks database and Internet robot.
4 """
5
6 __version__ = "$Revision$"[11:-2]
7 __revision__ = "$Id$"[5:-2]
8 __date__ = "$Date$"[7:-2]
9 __author__ = "Oleg Broytman <phd@phdru.name>"
10 __copyright__ = "Copyright (C) 2000-2011 PhiloSoft Design"
11 __license__ = "GNU GPL"
12
13 __all__ = ['storage_pickle']
14
15
16 try:
17    import cPickle
18    pickle = cPickle
19
20 except ImportError:
21    import pickle
22
23
24 class storage_pickle:
25    filename = "bookmarks_db.pickle"
26
27    def store(self, root_folder):
28       outfile = open(self.filename, 'wb')
29       pickle.dump(root_folder, outfile, 1)
30       outfile.close()
31
32    def load(self):
33       infile = open(self.filename, 'rb')
34       root_folder = pickle.load(infile)
35       infile.close()
36
37       return root_folder