Skip to content

Commit

Permalink
[FIX] tools.misc: log errors when parsing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
odony committed Feb 3, 2016
1 parent bdbcbea commit cb609bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openerp/tools/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,11 +1094,15 @@ def strip(args, i):

class Pickle(object):
@classmethod
def load(cls, stream):
def load(cls, stream, errors=False):
unpickler = cPickle.Unpickler(stream)
# pickle builtins: str/unicode, int/long, float, bool, tuple, list, dict, None
unpickler.find_global = None
return unpickler.load()
try:
return unpickler.load()
except Exception:
_logger.warning('Failed unpickling data, returning default: %r', errors, exc_info=True)
return errors

@classmethod
def loads(cls, text):
Expand Down

0 comments on commit cb609bd

Please sign in to comment.