[llvm-commits] [LNT] r163166 - /lnt/trunk/lnt/server/ui/decorators.py
Michael Gottesman
mgottesman at apple.com
Tue Sep 4 14:54:52 PDT 2012
Author: mgottesman
Date: Tue Sep 4 16:54:52 2012
New Revision: 163166
URL: http://llvm.org/viewvc/llvm-project?rev=163166&view=rev
Log:
[LNT] Add code to decorators which will ensure that all transactions
began inside a handled request are closed when the aforementioned
request has been handled.
Modified:
lnt/trunk/lnt/server/ui/decorators.py
Modified: lnt/trunk/lnt/server/ui/decorators.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/decorators.py?rev=163166&r1=163165&r2=163166&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/decorators.py (original)
+++ lnt/trunk/lnt/server/ui/decorators.py Tue Sep 4 16:54:52 2012
@@ -1,6 +1,7 @@
import flask
from flask import abort
from flask import current_app, g, render_template
+from flask import request
frontend = flask.Module(__name__)
@@ -27,8 +28,14 @@
UI support for database with version %r is not yet implemented.""" % (
g.db_info.db_version))
+ # Compute result.
+ result = f(**args)
- return f(**args)
+ # Make sure that any transactions begun by this request are finished.
+ request.get_db().rollback()
+
+ # Return result.
+ return result
frontend.add_url_rule(rule, f.__name__, wrap, **options)
frontend.add_url_rule("/db_<db_name>" + rule,
@@ -56,7 +63,14 @@
if g.db_info is None:
abort(404)
- return f(**args)
+ # Compute result.
+ result = f(**args)
+
+ # Make sure that any transactions begun by this request are finished.
+ request.get_db().rollback()
+
+ # Return result.
+ return result
frontend.add_url_rule("/v4/<testsuite_name>" + rule,
f.__name__, wrap, **options)
More information about the llvm-commits
mailing list