summaryrefslogtreecommitdiff
path: root/indra/lib
diff options
context:
space:
mode:
authorAaron Brashears <aaronb@lindenlab.com>2007-08-02 19:05:10 +0000
committerAaron Brashears <aaronb@lindenlab.com>2007-08-02 19:05:10 +0000
commitb387b98bd09119397b43a68567383401d0bcd532 (patch)
tree1ee985f39b6b5ee9ec1ea34d979e255c4f08096e /indra/lib
parent7138fb673ac3df46b9cb5f23d0d74e70fdd2b6b3 (diff)
Result of svn merge -r67150:67159 svn+ssh://svn/svn/linden/branches/mp-backbone-2 into release.
Diffstat (limited to 'indra/lib')
-rw-r--r--indra/lib/python/indra/base/llsd.py4
-rw-r--r--indra/lib/python/indra/ipc/russ.py14
2 files changed, 16 insertions, 2 deletions
diff --git a/indra/lib/python/indra/base/llsd.py b/indra/lib/python/indra/base/llsd.py
index 1af07e5885..18e62b0817 100644
--- a/indra/lib/python/indra/base/llsd.py
+++ b/indra/lib/python/indra/base/llsd.py
@@ -788,8 +788,8 @@ def parse(something):
return to_python(fromstring(something)[0])
else:
return LLSDNotationParser().parse(something)
- except KeyError:
- raise Exception('LLSD could not be parsed: %s' % (something,))
+ except KeyError, e:
+ raise Exception('LLSD could not be parsed: %s' % (e,))
class LLSD(object):
def __init__(self, thing=None):
diff --git a/indra/lib/python/indra/ipc/russ.py b/indra/lib/python/indra/ipc/russ.py
index f6f67d4314..a9ebd8bb03 100644
--- a/indra/lib/python/indra/ipc/russ.py
+++ b/indra/lib/python/indra/ipc/russ.py
@@ -25,6 +25,18 @@ class UnknownDirective(Exception):
class BadDirective(Exception):
pass
+def format_value_for_path(value):
+ if type(value) in [list, tuple]:
+ # *NOTE: treat lists as unquoted path components so that the quoting
+ # doesn't get out-of-hand. This is a workaround for the fact that
+ # russ always quotes, even if the data it's given is already quoted,
+ # and it's not safe to simply unquote a path directly, so if we want
+ # russ to substitute urls parts inside other url parts we always
+ # have to do so via lists of unquoted path components.
+ return '/'.join([urllib.quote(str(item)) for item in value])
+ else:
+ return urllib.quote(str(value))
+
def format(format_str, context):
"""@brief Format format string according to rules for RUSS.
@see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax
@@ -50,6 +62,8 @@ def format(format_str, context):
#print "directive:", format_str[pos+1:pos+5]
if format_str[pos + 1] == '$':
value = context.get(format_str[pos + 2:end])
+ if value is not None:
+ value = format_value_for_path(value)
elif format_str[pos + 1] == '%':
value = _build_query_string(
context.get(format_str[pos + 2:end]))