From dffb3d091c0e42b7254fe88218811c24c0054f7e Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 3 May 2010 14:39:16 +0200 Subject: [PATCH 1/2] Removed useless import and adapted tests --- flask.py | 1 - tests/flask_tests.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flask.py b/flask.py index c1229d6e..02014fd2 100644 --- a/flask.py +++ b/flask.py @@ -12,7 +12,6 @@ from __future__ import with_statement import os import sys -import types from datetime import datetime, timedelta from jinja2 import Environment, PackageLoader, FileSystemLoader diff --git a/tests/flask_tests.py b/tests/flask_tests.py index f9369e36..f8f74264 100644 --- a/tests/flask_tests.py +++ b/tests/flask_tests.py @@ -255,17 +255,17 @@ class BasicFunctionalityTestCase(unittest.TestCase): == '/static/index.html' def test_none_response(self): - warnings.filterwarnings('error', 'View function did not return') app = flask.Flask(__name__) @app.route('/') def test(): return None try: app.test_client().get('/') - except Warning: + except ValueError, e: + assert str(e) == 'View function did not return a response' pass else: - assert "Expected warning" + assert "Expected ValueError" class JSONTestCase(unittest.TestCase): From f345af8d9d33e6164747c865c29a72186a470c22 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 3 May 2010 19:58:07 +0200 Subject: [PATCH 2/2] Use unicode in SQLAlchemy pattern. --- docs/patterns/sqlalchemy.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/patterns/sqlalchemy.rst b/docs/patterns/sqlalchemy.rst index 32d41c08..3945c1fa 100644 --- a/docs/patterns/sqlalchemy.rst +++ b/docs/patterns/sqlalchemy.rst @@ -25,7 +25,7 @@ Here the example `database.py` module for your application:: from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base - engine = create_engine('sqlite:////tmp/test.db') + engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True) db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine)) @@ -104,7 +104,7 @@ Here is an example `database.py` module for your application:: from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import scoped_session, sessionmaker - engine = create_engine('sqlite:////tmp/test.db') + engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True) metadata = MetaData() db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, @@ -156,7 +156,7 @@ you basically only need the engine:: from sqlalchemy import create_engine, MetaData - engine = create_engine('sqlite:////tmp/test.db') + engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True) metadata = MetaData(bind=engine) Then you can either declare the tables in your code like in the examples