summaryrefslogtreecommitdiff
path: root/indra/lib/python/indra/ipc
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2008-11-18 21:20:05 +0000
committerChristian Goetze <cg@lindenlab.com>2008-11-18 21:20:05 +0000
commita86aa7d8b08f326e9422e321467dfed7ffe97a4c (patch)
tree276f78d91a21356a39becf91e319879b5d6f219b /indra/lib/python/indra/ipc
parentba9cf4aa151950039d4e098b5637a35a204b7f6b (diff)
QAR-963 svn merge -r101685:101752 svn+ssh://svn.lindenlab.com/svn/linden/branches/rad-chilies/rc05-release-merge
Diffstat (limited to 'indra/lib/python/indra/ipc')
-rw-r--r--indra/lib/python/indra/ipc/servicebuilder.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/indra/lib/python/indra/ipc/servicebuilder.py b/indra/lib/python/indra/ipc/servicebuilder.py
index ebd2583385..13a36a392d 100644
--- a/indra/lib/python/indra/ipc/servicebuilder.py
+++ b/indra/lib/python/indra/ipc/servicebuilder.py
@@ -51,12 +51,10 @@ def build(name, context={}, **kwargs):
> servicebuilder.build('version-manager-version', context, version='1.18.1.2')
'http://int.util.vaak.lindenlab.com/channel/Second%20Life%20Release/1.18.1.2'
"""
- context = context.copy() # shouldn't modify the caller's dictionary
- context.update(kwargs)
global _g_builder
if _g_builder is None:
_g_builder = ServiceBuilder()
- return _g_builder.buildServiceURL(name, context)
+ return _g_builder.buildServiceURL(name, context, **kwargs)
class ServiceBuilder(object):
def __init__(self, services_definition = services_config):
@@ -81,13 +79,36 @@ class ServiceBuilder(object):
else:
self.builders[service['name']] = service_builder
- def buildServiceURL(self, name, context):
+ def buildServiceURL(self, name, context={}, **kwargs):
"""\
@brief given the environment on construction, return a service URL.
@param name The name of the service.
@param context A dict of name value lookups for the service.
+ @param kwargs Any keyword arguments are treated as members of the
+ context, this allows you to be all 31337 by writing shit like:
+ servicebuilder.build('name', param=value)
@returns Returns the
"""
+ context = context.copy() # shouldn't modify the caller's dictionary
+ context.update(kwargs)
base_url = config.get('services-base-url')
svc_path = russ.format(self.builders[name], context)
return base_url + svc_path
+
+
+def on_in(query_name, host_key, schema_key):
+ """\
+ @brief Constructs an on/in snippet (for running named queries)
+ from a schema name and two keys referencing values stored in
+ indra.xml.
+
+ @param query_name Name of the query.
+ @param host_key Logical name of destination host. Will be
+ looked up in indra.xml.
+ @param schema_key Logical name of destination schema. Will
+ be looked up in indra.xml.
+ """
+ host_name = config.get(host_key)
+ schema_name = config.get(schema_key)
+ return '/'.join( ('on', host_name, 'in', schema_name, query_name.lstrip('/')) )
+