From d5421707fcd6d8ab6bd8289e10b9a13518a77808 Mon Sep 17 00:00:00 2001 From: ianb Date: Sat, 7 May 2005 07:45:38 +0000 Subject: Tried (but still failing) to handle URL movement better --- examples/console/JSONComponent/jsoncomponent.py | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/examples/console/JSONComponent/jsoncomponent.py b/examples/console/JSONComponent/jsoncomponent.py index e4af31c..d64ad91 100644 --- a/examples/console/JSONComponent/jsoncomponent.py +++ b/examples/console/JSONComponent/jsoncomponent.py @@ -10,7 +10,7 @@ class JSONServletComponent(ServletComponent): _servletMethods = ['jsonaction', 'jsonjs'] def __init__(self, jsolaitURL='jsolait', - libURL='jsolait', + libURL='', baseConfig=None, jsonMethods=()): self.baseConfig = baseConfig @@ -53,28 +53,32 @@ class JSONServletComponent(ServletComponent): def jsonjs(self): env = self.servlet().request().environ() - base = self.jsolaitURL + jsolaitURL = self.jsolaitURL lib = self.libURL here = wsgilib.construct_url(env, False) here += '?_action_=jsonaction'; if self.baseConfig: - base_base = env['%s.base_url' % self.baseConfig] - if not base.startswith('/'): - base = base_base + '/' + base + app_base = env['%s.base_url' % self.baseConfig] + if not jsolaitURL.startswith('/'): + jsolaitURL = app_base + '/' + jsolaitURL if not lib.startswith('/'): - lib = base_base + '/' + lib - base = 'jsolait' + lib = app_base + '/' + lib text = (r''' - - - - + + + + + ''' - % {'base': base, + % {'jsolaitURL': jsolaitURL, 'lib': lib, 'here': here, 'methods': self.jsonMethods()}) @@ -84,10 +88,10 @@ class JSONComponent(Component): _componentClass = JSONServletComponent """ - + """ -- cgit v1.2.1