diff options
author | Aaron Brashears <aaronb@lindenlab.com> | 2007-08-02 19:05:10 +0000 |
---|---|---|
committer | Aaron Brashears <aaronb@lindenlab.com> | 2007-08-02 19:05:10 +0000 |
commit | b387b98bd09119397b43a68567383401d0bcd532 (patch) | |
tree | 1ee985f39b6b5ee9ec1ea34d979e255c4f08096e /indra/lib/python/indra/ipc | |
parent | 7138fb673ac3df46b9cb5f23d0d74e70fdd2b6b3 (diff) |
Result of svn merge -r67150:67159 svn+ssh://svn/svn/linden/branches/mp-backbone-2 into release.
Diffstat (limited to 'indra/lib/python/indra/ipc')
-rw-r--r-- | indra/lib/python/indra/ipc/russ.py | 14 |
1 files changed, 14 insertions, 0 deletions
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])) |