Merge pull request #4302 from karintou8710/old-print
Fixes old print statement in signal and SQLite pages
This commit is contained in:
commit
ded812b0cd
2 changed files with 4 additions and 4 deletions
|
|
@ -113,16 +113,16 @@ raw cursor and connection objects.
|
||||||
Here is how you can use it::
|
Here is how you can use it::
|
||||||
|
|
||||||
for user in query_db('select * from users'):
|
for user in query_db('select * from users'):
|
||||||
print user['username'], 'has the id', user['user_id']
|
print(user['username'], 'has the id', user['user_id'])
|
||||||
|
|
||||||
Or if you just want a single result::
|
Or if you just want a single result::
|
||||||
|
|
||||||
user = query_db('select * from users where username = ?',
|
user = query_db('select * from users where username = ?',
|
||||||
[the_username], one=True)
|
[the_username], one=True)
|
||||||
if user is None:
|
if user is None:
|
||||||
print 'No such user'
|
print('No such user')
|
||||||
else:
|
else:
|
||||||
print the_username, 'has the id', user['user_id']
|
print(the_username, 'has the id', user['user_id'])
|
||||||
|
|
||||||
To pass variable parts to the SQL statement, use a question mark in the
|
To pass variable parts to the SQL statement, use a question mark in the
|
||||||
statement and pass in the arguments as a list. Never directly add them to
|
statement and pass in the arguments as a list. Never directly add them to
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ With Blinker 1.1 you can also easily subscribe to signals by using the new
|
||||||
|
|
||||||
@template_rendered.connect_via(app)
|
@template_rendered.connect_via(app)
|
||||||
def when_template_rendered(sender, template, context, **extra):
|
def when_template_rendered(sender, template, context, **extra):
|
||||||
print f'Template {template.name} is rendered with {context}'
|
print(f'Template {template.name} is rendered with {context}')
|
||||||
|
|
||||||
Core Signals
|
Core Signals
|
||||||
------------
|
------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue