Exemplo n.º 1
0
 def set(self, key, data):
     filename = path.join(self.directory, '%s' % make_md5(self.V, key))
     f = open(filename, 'wb')
     try:
         f.write(pickle.dumps(data))
     finally:
         f.close()
Exemplo n.º 2
0
 def set(self, key, data):
     filename = path.join(self.directory, '%s' % make_md5(self.V, key))
     f = open(filename, 'wb')
     try:
         f.write(pickle.dumps(data))
     finally:
         f.close()
Exemplo n.º 3
0
def maybe_pickle(value):
    """Pickle the given value if it is not a string."""
    if not isinstance(value, basestring):
        return pickle.dumps(value)
    return value
Exemplo n.º 4
0
def maybe_pickle(value):
    """Pickle the given value if it is not a string."""
    if not isinstance(value, str):
        return pickle.dumps(value)
    return value