fix error "has no len()"

This commit is contained in:
frack113 2021-08-20 09:20:56 +02:00
parent 9b106dcc7d
commit 4e895da471

View File

@ -277,9 +277,10 @@ class SingleTextQueryBackend(RulenameCommentMixin, BaseBackend, QuoteCharMixin):
def generateSubexpressionNode(self, node):
generated = self.generateNode(node.items)
if len(node.items) == 1:
# A sub expression with length 1 is not a proper sub expression, no self.subExpression required
return generated
if 'len'in dir(node.items): # fix the "TypeError: object of type 'NodeSubexpression' has no len()"
if len(node.items) == 1:
# A sub expression with length 1 is not a proper sub expression, no self.subExpression required
return generated
if generated:
return self.subExpression % generated
else: