#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
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')
--- /dev/null
+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')
+