From 29b07d2e5711f8c5565a1ec317af6596ee1e431d Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 28 May 2014 20:31:32 -0700 Subject: [PATCH] Allow indent text to be passed in Instead of forcing single space indenting allow the indenting string to be passed in so that others can provided their favorite indent (tabs, two spaces or other...) Change-Id: I2dfb3baeaecb8bed197429b591daed69eb8cc834 --- taskflow/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskflow/exceptions.py b/taskflow/exceptions.py index 95e378af..2aff08aa 100644 --- a/taskflow/exceptions.py +++ b/taskflow/exceptions.py @@ -34,7 +34,7 @@ class TaskFlowException(Exception): def cause(self): return self._cause - def pformat(self, indent=2): + def pformat(self, indent=2, indent_text=" "): """Pretty formats a taskflow exception + any connected causes.""" if indent < 0: raise ValueError("indent must be greater than or equal to zero") @@ -45,7 +45,7 @@ class TaskFlowException(Exception): # We'll add our own newlines on at the end of formatting. if line.endswith("\n"): line = line[0:-1] - lines.append((" " * indent_by) + line) + lines.append((indent_text * indent_by) + line) try: lines.extend(_format(excp.cause, indent_by + indent)) except AttributeError: