Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/creactivistore/_templates/lib/flask/globals.py
diff options
context:
space:
mode:
authorflorent <florent.pigout@gmail.com>2011-09-12 08:13:38 (GMT)
committer florent <florent.pigout@gmail.com>2011-09-12 08:13:38 (GMT)
commit1211310e0363e41b2479cd2dbcc5c6b8dee42f54 (patch)
treece81216969347ddfc9a8c050b654c99a1d76d6a9 /creactivistore/_templates/lib/flask/globals.py
parent7cc16a4469c6dc40ea4c18eb302df41f3802c14e (diff)
add template for triplestore web based project
Diffstat (limited to 'creactivistore/_templates/lib/flask/globals.py')
-rw-r--r--creactivistore/_templates/lib/flask/globals.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/creactivistore/_templates/lib/flask/globals.py b/creactivistore/_templates/lib/flask/globals.py
new file mode 100644
index 0000000..8471410
--- /dev/null
+++ b/creactivistore/_templates/lib/flask/globals.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+"""
+ flask.globals
+ ~~~~~~~~~~~~~
+
+ Defines all the global objects that are proxies to the current
+ active context.
+
+ :copyright: (c) 2010 by Armin Ronacher.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from functools import partial
+from werkzeug import LocalStack, LocalProxy
+
+def _lookup_object(name):
+ top = _request_ctx_stack.top
+ if top is None:
+ raise RuntimeError('working outside of request context')
+ return getattr(top, name)
+
+# context locals
+_request_ctx_stack = LocalStack()
+current_app = LocalProxy(partial(_lookup_object, 'app'))
+request = LocalProxy(partial(_lookup_object, 'request'))
+session = LocalProxy(partial(_lookup_object, 'session'))
+g = LocalProxy(partial(_lookup_object, 'g'))