eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityUtils.py

changeset 7622
384e2aa5c073
parent 7615
ca2949b1a29a
child 7628
f904d0eef264
diff -r ffd1f00ca376 -r 384e2aa5c073 eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityUtils.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityUtils.py	Tue Jun 16 17:44:28 2020 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityUtils.py	Tue Jun 16 17:45:12 2020 +0200
@@ -10,6 +10,8 @@
 import ast
 import os
 
+import AstUtilities
+
 
 class InvalidModulePath(Exception):
     """
@@ -264,14 +266,14 @@
     """
     Function to build a string from an ast.BinOp chain.
 
-    This will build a string from a series of ast.Str nodes wrapped in
-    ast.BinOp nodes. Something like "a" + "b" + "c" or "a %s" % val etc.
-    The provided node can be any participant in the BinOp chain.
+    This will build a string from a series of ast.Str/ast.Constant nodes
+    wrapped in ast.BinOp nodes. Something like "a" + "b" + "c" or "a %s" % val
+    etc. The provided node can be any participant in the BinOp chain.
     
     @param node node to be processed
-    @type ast.BinOp or ast.Str
+    @type ast.BinOp or ast.Str/ast.Constant
     @param stop base node to stop at
-    @type ast.BinOp or ast.Str
+    @type ast.BinOp or ast.Str/ast.Constant
     @return tuple containing the root node of the expression and the string
         value
     @rtype tuple of (ast.AST, str)
@@ -297,7 +299,7 @@
     
     return (
         node,
-        " ".join([x.s for x in bits if isinstance(x, ast.Str)])
+        " ".join([x.s for x in bits if AstUtilities.isString(x)])
     )
 
 

eric ide

mercurial