fix minitwit/flaskr test errors, improve docs about file open mode

app.open_resource needs to get called with the correct mode param (python3
will read bytes [not str] if the wrong mode is used), add mode param docs.

rv.data is bytes, fix the data type we compare it with to be also bytes
This commit is contained in:
Thomas Waldmann 2013-05-25 19:13:48 +02:00
parent 85ba8c96e9
commit 8bb972e5ae
8 changed files with 42 additions and 40 deletions

View file

@ -124,7 +124,7 @@ can do that for you::
def init_db():
with app.app_context():
db = get_db()
with app.open_resource('schema.sql') as f:
with app.open_resource('schema.sql', mode='r') as f:
db.cursor().executescript(f.read())
db.commit()