[open-ils-commits] r9205 - in
branches/acq-experiment/Open-ILS/web/oilsweb: .
oilsweb/config oilsweb/controllers
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Apr 3 00:03:12 EDT 2008
Author: erickson
Date: 2008-04-02 23:26:49 -0400 (Wed, 02 Apr 2008)
New Revision: 9205
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/translator.py
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/development.ini
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/config/routing.py
Log:
built an opensrf http translator proxy for paster so mod_python is not required for development
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/development.ini
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/development.ini 2008-04-03 02:27:41 UTC (rev 9204)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/development.ini 2008-04-03 03:26:49 UTC (rev 9205)
@@ -67,8 +67,13 @@
#oils_demo_workstation = BR1-demo
+# when using the opensrf translator proxy, define the
+# translator host and path here
+#osrf_http_translator_host = localhost:80
+#osrf_http_translator_path = /osrf-http-translator
+
# Logging configuration
[loggers]
keys = root, oilsweb
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/config/routing.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/config/routing.py 2008-04-03 02:27:41 UTC (rev 9204)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/config/routing.py 2008-04-03 03:26:49 UTC (rev 9205)
@@ -27,6 +27,7 @@
map.connect(prefix+'admin/:action/:type/:id', controller='admin')
map.connect(prefix+'admin/:action/:type', controller='admin')
+ map.connect('osrf-http-translator', controller='translator', action='proxy')
''' trying a different set of admin routes above...
map.connect('acq_admin', 'oils/admin', controller='acq_admin')
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/translator.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/translator.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/translator.py 2008-04-03 03:26:49 UTC (rev 9205)
@@ -0,0 +1,24 @@
+from oilsweb.lib.base import *
+import urllib2, urllib, httplib
+import osrf.json
+import pylons
+
+class TranslatorController(BaseController):
+ ''' This controller acts as a proxy for the OpenSRF http translator
+ so that paster can handle opensrf AJAX requests. '''
+ def proxy(self):
+ try:
+ headers = {}
+ for k,v in request.headers.iteritems():
+ headers[k] = v
+ conn = httplib.HTTPConnection(pylons.config['osrf_http_translator_host'])
+ conn.request("POST", pylons.config['osrf_http_translator_path'],
+ urllib.urlencode({'osrf-msg':request.params['osrf-msg']}), headers)
+ resp = conn.getresponse()
+ for h in resp.getheaders():
+ response.headers[h[0]] = h[1]
+ return resp.read()
+ except Exception, e:
+ import sys
+ sys.stderr.write(unicode(e) + '\n')
+
More information about the open-ils-commits
mailing list