]> git.saurik.com Git - cyql.git/commitdiff
Use s formatting flag for %{} and assert it for %()s.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 5 Feb 2011 21:24:27 +0000 (21:24 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 5 Feb 2011 21:24:27 +0000 (21:24 +0000)
__init__.py

index a21ba318dc353209976a6ab81c83d71eab1ea27b..e01c53361ebf699834ba4090a74c957e0f77e0d7 100644 (file)
@@ -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