From 5f769f76414e4f5ce3e330d2c2cd62ddb2bd0a08 Mon Sep 17 00:00:00 2001 From: stroeder Date: Wed, 22 Feb 2017 20:25:21 +0000 Subject: [PATCH] split_tokens(): old string formatting when raising ValueError to be compatible with older Python versions --- Lib/ldap/schema/tokenizer.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Lib/ldap/schema/tokenizer.py b/Lib/ldap/schema/tokenizer.py index aa54785..2faeac5 100644 --- a/Lib/ldap/schema/tokenizer.py +++ b/Lib/ldap/schema/tokenizer.py @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -\$Id: tokenizer.py,v 1.15 2017/02/20 10:25:47 stroeder Exp $ +\$Id: tokenizer.py,v 1.16 2017/02/22 20:25:21 stroeder Exp $ """ import re @@ -24,8 +24,7 @@ def split_tokens(s): """ - Returns list of syntax elements with quotes and spaces - stripped. + Returns list of syntax elements with quotes and spaces stripped. """ parts = [] parens = 0 @@ -42,14 +41,13 @@ def split_tokens(s): parts.append(cpar) elif residue == '$': if not parens: - raise ValueError("'$' outside parenthesis") + raise ValueError("'$' outside parenthesis in %r" % (s)) else: raise ValueError(residue, s) if parens: - raise ValueError('Unbalanced parenthesis in %r' % s) + raise ValueError("Unbalanced parenthesis in %r" % (s)) return parts - def extract_tokens(l,known_tokens): """ Returns dictionary of known tokens with all values