From 055ceab9be595fbf08a3d3399698901068eb4afb Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Mon, 7 Sep 2009 17:09:43 -0800 Subject: [PATCH] support telling us that you want debug information on why calling your function failed... Default to off.. makes debugging a lot easier when testing the auto detect feature.. [git-p4: depot-paths = "//depot/": change = 1378] --- FSStorage.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/FSStorage.py b/FSStorage.py index e2428e5..18a19e4 100644 --- a/FSStorage.py +++ b/FSStorage.py @@ -27,8 +27,8 @@ mimedict = static.loadMimeTypes() _klassfuns = [] -def registerklassfun(fun): - _klassfuns.append(fun) +def registerklassfun(fun, debug=False): + _klassfuns.append((fun, debug)) _filestoignore = { '.DS_Store': None @@ -237,7 +237,7 @@ def dofileadd(path, name): fobj = open(fsname) except: fobj = None - for i in itertools.chain(( ignoreFiles, ), _klassfuns, ( defFS, )): + for i, debug in itertools.chain(( (ignoreFiles, False), ), _klassfuns, ( (defFS, False), )): try: try: # incase the call expects a clean file @@ -250,9 +250,9 @@ def dofileadd(path, name): if klass is not None: break except: - #import traceback - #traceback.print_exc(file=log.logfile) - pass + if debug: + import traceback + traceback.print_exc(file=log.logfile) if klass is None or klass is IgnoreFile: return None, None, None, None