use pickle

Signed-off-by: Mattias Andrée <maandree@operamail.com>
This commit is contained in:
Mattias Andrée 2013-04-03 22:57:59 +02:00
parent 50fb5f4095
commit 4a7c7279f5
2 changed files with 4 additions and 4 deletions

View file

@ -107,12 +107,12 @@ class Metadata():
'''
@staticmethod
def restrictedPonies(ponydir, logic):
import cPickle
import pickle
passed = []
if os.path.exists(ponydir + 'metadata'):
data = None
with open(ponydir + 'metadata', 'rb') as file:
data = cPickle.load(file)
data = pickle.load(file)
for ponydata in data:
(pony, meta) = ponydata
if logic(meta):

View file

@ -646,9 +646,9 @@ class PonysayTool():
if (len(test) == 0) and (len(key) > 0):
data.append((key, makeset(value.replace(' ', ''))))
everything.append((ponyfile[:-5], data))
import cPickle
import pickle
with open((ponydir + '/metadata').replace('//', '/'), 'wb') as file:
cPickle.dump(everything, file, -1)
pickle.dump(everything, file, -1)
file.flush()