moksha/lib/app_globals.py | 13 +++++++++++++
moksha/lib/helpers.py | 5 +----
2 files changed, 14 insertions(+), 4 deletions(-)
New commits:
commit ab2c41cf0d10d91a1828f1005107ab5545bf89f3
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Feb 17 18:56:15 2009 -0500
Fix a typo
diff --git a/moksha/lib/app_globals.py b/moksha/lib/app_globals.py
index e630ecd..b36c74e 100644
--- a/moksha/lib/app_globals.py
+++ b/moksha/lib/app_globals.py
@@ -39,4 +39,4 @@ class Globals(object):
frame = inspect.currentframe()
caller = frame.f_back.f_back.f_globals['__name__']
print "caller = ", caller
- return object.__getattr__(self, *args, **kw)
+ return object.__getattribute__(self, *args, **kw)
commit 5cc65b253c17b7505d4a301f28dfc009b2b6b6f4
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Feb 17 18:55:33 2009 -0500
Start hashing out the beginnings of moksha app namespaced Globals objects
diff --git a/moksha/lib/app_globals.py b/moksha/lib/app_globals.py
index 230c024..e630ecd 100644
--- a/moksha/lib/app_globals.py
+++ b/moksha/lib/app_globals.py
@@ -1,6 +1,7 @@
"""The application's Globals object"""
import logging
+import inspect
from tg import config
from shove import Shove
@@ -27,3 +28,15 @@ class Globals(object):
except CacheBackendException, e:
log.warning(str(e))
self.cache = None
+
+ def __getattribute__(self, *args, **kw):
+ # @@ TODO: Namespace moksha app's Global objects
+ # load them in the middlware...
+ # ensure that this object is always in pylons.g, even if we are
+ # running a full moksha stack, or as middleware
+ # proxy to them on incoming request
+ print "Globals.__getattr__(%s)" % locals()
+ frame = inspect.currentframe()
+ caller = frame.f_back.f_back.f_globals['__name__']
+ print "caller = ", caller
+ return object.__getattr__(self, *args, **kw)
commit d6a0e09b934ac31cc4c7fd6806eb62958ce39a92
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Feb 17 18:32:31 2009 -0500
No need to import pylons more than once in our helpers
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index 10768e4..6fa9426 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.py
@@ -408,15 +408,12 @@ def check_predicates(predicates):
:return: False is any one is False
:return: True if they are all True
"""
-
- from pylons import request
-
if(not(isinstance(predicates, list) or isinstance(predicates, tuple))):
predicates = (predicates,)
for p in predicates:
try:
- check_authorization(p, request.environ)
+ check_authorization(p, pylons.request.environ)
except NotAuthorizedError, e:
return False