summaryrefslogtreecommitdiff
path: root/indra/lib
diff options
context:
space:
mode:
authorAaron Brashears <aaronb@lindenlab.com>2008-09-29 17:41:54 +0000
committerAaron Brashears <aaronb@lindenlab.com>2008-09-29 17:41:54 +0000
commit66739da16407a8e56accc236bd3996c1963a6bcf (patch)
tree2b8e1d8b4560880b8427231dec5f8c11a6ab5ec0 /indra/lib
parent13c96cc47ba104483fa6a5f2c2c197f7b66fdecf (diff)
Result of svn merge -r97546:97641 svn+ssh://svn/svn/linden/branches/apache-caps/merge-to-release into release. QAR-824
Diffstat (limited to 'indra/lib')
-rw-r--r--indra/lib/python/indra/base/llsd.py56
-rw-r--r--indra/lib/python/indra/ipc/llsdhttp.py2
-rw-r--r--indra/lib/python/indra/ipc/siesta.py4
3 files changed, 57 insertions, 5 deletions
diff --git a/indra/lib/python/indra/base/llsd.py b/indra/lib/python/indra/base/llsd.py
index 521b79c65a..17ab89004a 100644
--- a/indra/lib/python/indra/base/llsd.py
+++ b/indra/lib/python/indra/base/llsd.py
@@ -969,6 +969,9 @@ class LLSD(object):
undef = LLSD(None)
+XML_MIME_TYPE = 'application/llsd+xml'
+BINARY_MIME_TYPE = 'application/llsd+binary'
+
# register converters for llsd in mulib, if it is available
try:
from mulib import stacked, mu
@@ -978,7 +981,7 @@ except:
# mulib not available, don't print an error message since this is normal
pass
else:
- mu.add_parser(parse, 'application/llsd+xml')
+ mu.add_parser(parse, XML_MIME_TYPE)
mu.add_parser(parse, 'application/llsd+binary')
def llsd_convert_xml(llsd_stuff, request):
@@ -987,11 +990,58 @@ else:
def llsd_convert_binary(llsd_stuff, request):
request.write(format_binary(llsd_stuff))
- for typ in [LLSD, dict, list, tuple, str, int, float, bool, unicode, type(None)]:
- stacked.add_producer(typ, llsd_convert_xml, 'application/llsd+xml')
+ for typ in [LLSD, dict, list, tuple, str, int, long, float, bool, unicode, type(None)]:
+ stacked.add_producer(typ, llsd_convert_xml, XML_MIME_TYPE)
stacked.add_producer(typ, llsd_convert_xml, 'application/xml')
stacked.add_producer(typ, llsd_convert_xml, 'text/xml')
stacked.add_producer(typ, llsd_convert_binary, 'application/llsd+binary')
stacked.add_producer(LLSD, llsd_convert_xml, '*/*')
+
+ # in case someone is using the legacy mu.xml wrapper, we need to
+ # tell mu to produce application/xml or application/llsd+xml
+ # (based on the accept header) from raw xml. Phoenix 2008-07-21
+ stacked.add_producer(mu.xml, mu.produce_raw, XML_MIME_TYPE)
+ stacked.add_producer(mu.xml, mu.produce_raw, 'application/xml')
+
+
+
+# mulib wsgi stuff
+# try:
+# from mulib import mu, adapters
+#
+# # try some known attributes from mulib to be ultra-sure we've imported it
+# mu.get_current
+# adapters.handlers
+# except:
+# # mulib not available, don't print an error message since this is normal
+# pass
+# else:
+# def llsd_xml_handler(content_type):
+# def handle_llsd_xml(env, start_response):
+# llsd_stuff, _ = mu.get_current(env)
+# result = format_xml(llsd_stuff)
+# start_response("200 OK", [('Content-Type', content_type)])
+# env['mu.negotiated_type'] = content_type
+# yield result
+# return handle_llsd_xml
+#
+# def llsd_binary_handler(content_type):
+# def handle_llsd_binary(env, start_response):
+# llsd_stuff, _ = mu.get_current(env)
+# result = format_binary(llsd_stuff)
+# start_response("200 OK", [('Content-Type', content_type)])
+# env['mu.negotiated_type'] = content_type
+# yield result
+# return handle_llsd_binary
+#
+# adapters.DEFAULT_PARSERS[XML_MIME_TYPE] = parse
+
+# for typ in [LLSD, dict, list, tuple, str, int, float, bool, unicode, type(None)]:
+# for content_type in (XML_MIME_TYPE, 'application/xml'):
+# adapters.handlers.set_handler(typ, llsd_xml_handler(content_type), content_type)
+#
+# adapters.handlers.set_handler(typ, llsd_binary_handler(BINARY_MIME_TYPE), BINARY_MIME_TYPE)
+#
+# adapters.handlers.set_handler(LLSD, llsd_xml_handler(XML_MIME_TYPE), '*/*')
diff --git a/indra/lib/python/indra/ipc/llsdhttp.py b/indra/lib/python/indra/ipc/llsdhttp.py
index c45489643e..ea4608c82b 100644
--- a/indra/lib/python/indra/ipc/llsdhttp.py
+++ b/indra/lib/python/indra/ipc/llsdhttp.py
@@ -51,6 +51,8 @@ request_ = suite.request_
# import every httpc error exception into our namespace for convenience
for x in httpc.status_to_error_map.itervalues():
globals()[x.__name__] = x
+ConnectionError = httpc.ConnectionError
+Retriable = httpc.Retriable
for x in (httpc.ConnectionError,):
globals()[x.__name__] = x
diff --git a/indra/lib/python/indra/ipc/siesta.py b/indra/lib/python/indra/ipc/siesta.py
index 5fbea29339..b206f181c4 100644
--- a/indra/lib/python/indra/ipc/siesta.py
+++ b/indra/lib/python/indra/ipc/siesta.py
@@ -24,9 +24,9 @@ except ImportError:
llsd_parsers = {
'application/json': json_decode,
- 'application/llsd+binary': llsd.parse_binary,
+ llsd.BINARY_MIME_TYPE: llsd.parse_binary,
'application/llsd+notation': llsd.parse_notation,
- 'application/llsd+xml': llsd.parse_xml,
+ llsd.XML_MIME_TYPE: llsd.parse_xml,
'application/xml': llsd.parse_xml,
}