Merge "Add CLI in verigraph."
authorxiaodong shang <shang.xiaodong@zte.com.cn>
Fri, 17 Aug 2018 03:37:02 +0000 (03:37 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Fri, 17 Aug 2018 03:37:02 +0000 (03:37 +0000)
tosca2heat/tosca-parser/toscaparser/common/exception.py
tosca2heat/tosca-parser/toscaparser/shell.py

index 67a9f7f..d36a714 100644 (file)
@@ -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():
index 88c7473..83a015c 100644 (file)
@@ -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