Mercurial > hg > ltpdarepo
changeset 98:84672a6ac38b
Better implement and enable database schema version check.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Sun, 21 Aug 2011 18:35:49 +0200 |
parents | cd4a15072c97 |
children | f6baba33612e |
files | src/ltpdarepo/__init__.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/__init__.py Sun Aug 21 18:17:27 2011 +0200 +++ b/src/ltpdarepo/__init__.py Sun Aug 21 18:35:49 2011 +0200 @@ -30,8 +30,11 @@ curs = g.db.cursor() curs.execute("SELECT value+0 FROM options WHERE name='version'") g.schema = curs.fetchone()[0] - #if g.schema != SCHEMA and '/static/' not in request.url: - # return render_template('error.html', error=u'500: Needs upgrade'), 500 + if g.schema != SCHEMA and '/static/' not in request.url: + raise InternalServerError( + '<p>The database needs to be upgraded.</p><p>' + 'Current database schema version: %s. ' + 'Required version: %s.</p>' % (g.schema, SCHEMA)) @app.teardown_request