Skip to content

Commit d966298

Browse files
smariotjettify
authored andcommitted
Notify examples contain unsafe queries. (#464)
1 parent ad2f7cc commit d966298

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/notify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async def notify(conn):
99
for i in range(5):
1010
msg = "message {}".format(i)
1111
print('Send ->', msg)
12-
await cur.execute("NOTIFY channel, '{}'".format(msg))
12+
await cur.execute("NOTIFY channel, %s'", (msg,))
1313

1414
await cur.execute("NOTIFY channel, 'finish'")
1515

examples/notify_old_style.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def notify(conn):
1111
for i in range(5):
1212
msg = "message {}".format(i)
1313
print('Send ->', msg)
14-
yield from cur.execute("NOTIFY channel, '{}'".format(msg))
14+
yield from cur.execute("NOTIFY channel, %s", (msg,))
1515

1616
yield from cur.execute("NOTIFY channel, 'finish'")
1717
finally:

0 commit comments

Comments
 (0)