diff options
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/common/exception.py | 10 | ||||
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/shell.py | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/common/exception.py b/tosca2heat/tosca-parser/toscaparser/common/exception.py index 67a9f7f..d36a714 100644 --- a/tosca2heat/tosca-parser/toscaparser/common/exception.py +++ b/tosca2heat/tosca-parser/toscaparser/common/exception.py @@ -207,10 +207,14 @@ class ExceptionCollector(object): @staticmethod def removeException(exception_type): - if ExceptionCollector.collecting and ExceptionCollector.exceptions: + # if ExceptionCollector.collecting and ExceptionCollector.exceptions: + if ExceptionCollector.exceptions: + tmp_exceptions = [] for i, e in enumerate(ExceptionCollector.exceptions): - if isinstance(e, exception_type): - del ExceptionCollector.exceptions[i] + if not isinstance(e, exception_type): + tmp_exceptions.append(e) + # del ExceptionCollector.exceptions[i] + ExceptionCollector.exceptions = tmp_exceptions @staticmethod def exceptionsCaught(): diff --git a/tosca2heat/tosca-parser/toscaparser/shell.py b/tosca2heat/tosca-parser/toscaparser/shell.py index 88c7473..83a015c 100644 --- a/tosca2heat/tosca-parser/toscaparser/shell.py +++ b/tosca2heat/tosca-parser/toscaparser/shell.py @@ -97,9 +97,10 @@ class ParserShell(object): else: raise e - version = tosca.version if tosca else "unknown" - if tosca and tosca.version: - print("\nversion: " + version) + if tosca and hasattr(tosca, 'version'): + print("\nversion: " + tosca.version) + else: + print("\nversion: " + "unknown") if tosca and hasattr(tosca, 'description'): description = tosca.description |