From: Jay Freeman (saurik) Date: Sat, 5 Feb 2011 21:24:27 +0000 (+0000) Subject: Use s formatting flag for %{} and assert it for %()s. X-Git-Url: https://git.saurik.com/cyql.git/commitdiff_plain/0a3825ab303f4c9f1d515b612f54b72d769be81b?ds=inline Use s formatting flag for %{} and assert it for %()s. --- diff --git a/__init__.py b/__init__.py index a21ba31..e01c533 100644 --- a/__init__.py +++ b/__init__.py @@ -72,8 +72,10 @@ class connect(object): next = statement[percent + 1] if next == '(': start = statement.index(')', percent + 2) + 2 + assert statement[start - 1] == 's' elif next == '{': start = statement.index('}', percent + 2) + assert statement[start + 1] == 's' code = statement[percent + 2:start] if f_globals == None: @@ -83,7 +85,7 @@ class connect(object): # XXX: compile() in the frame's context context[key] = eval(code, f_globals, f_locals) - statement = '%s%%(%s)s%s' % (statement[0:percent], key, statement[start + 1:]) + statement = '%s%%(%s)%s' % (statement[0:percent], key, statement[start + 1:]) start = percent + len(key) + 4 elif next in ('%', 's'): start = percent + 2