moksha/connector/connector.py | 5 +++++
moksha/middleware/connector.py | 10 +++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 1c88c76218d9e838a93d43a66fa7d12e783c88f8
Merge: 64d16ec... f1c50ee...
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Mar 10 17:59:56 2009 -0400
Merge branch 'master' of git+ssh://johnp@git.fedorahosted.org/git/moksha
commit 64d16ecb063830f651da14d45617275e8e84c5b6
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Mar 10 17:59:21 2009 -0400
pass the environ and request to connectors
diff --git a/moksha/connector/connector.py b/moksha/connector/connector.py
index f985cf8..c93c3af 100644
--- a/moksha/connector/connector.py
+++ b/moksha/connector/connector.py
@@ -80,6 +80,11 @@ class IConnector(object):
All connectors must derive from this interface
"""
+ def __init__(self, environ=None, request=None):
+ super(IConnector, self).__init__()
+ self._environ = environ
+ self._request = request
+
@classmethod
def register(self):
""" This method is called when the connector middleware loads the
diff --git a/moksha/middleware/connector.py b/moksha/middleware/connector.py
index afb753b..6ce81c3 100644
--- a/moksha/middleware/connector.py
+++ b/moksha/middleware/connector.py
@@ -66,13 +66,17 @@ class MokshaConnectorMiddleware(object):
if k not in params:
params[k] = p.getall(k)
- response = self._run_connector(s[0], s[1], *s[2:], **params)
+ response = self._run_connector(environ, request,
+ s[0], s[1], *s[2:],
+ **params)
else:
response = request.get_response(self.application)
return response(environ, start_response)
- def _run_connector(self, conn, op, *path, **remote_params):
+ def _run_connector(self, environ, request,
+ conn, op, *path,
+ **remote_params):
response = None
# check last part of path to see if it is json data
dispatch_params = {};
@@ -98,7 +102,7 @@ class MokshaConnectorMiddleware(object):
conn = self._connectors.get(conn)
if conn:
- conn_obj = conn['connector_class']()
+ conn_obj = conn['connector_class'](environ, request)
r = conn_obj._dispatch(op, path, remote_params, **dispatch_params)
if not isinstance(r, str):
r = json.dumps(r, separators=(',',':'))