percious wrote:
> Ok, so I started digging, because I have to get this working for work
> now....
> Looking at the Tosca source: 
> http://svn.turbogears.org/projects/ToscaWidgets/trunk/tw/mods/base.py
> 
> The "url" function:
> 
> def url(self, url):
>         """
>         Returns the absolute path for the given url.
>         """
>         prefix = self.request_local.environ['toscawidgets.prefix']
>         script_name = self.request_local.environ['SCRIPT_NAME']
>         return ''.join([script_name, prefix, url])
> 
> 
> makes a call to a StackedObjectProxy object and pulls out the
> 'mytg2app' from 'SCRIPT_NAME'.  Is it possible to create the same
> StackedObjectProxy in the repoze software so that the redirect does a
> similar thing?

I'm not even sure what a StackedObjectProxy is.  I'm pretty sure repoze.who 
doesn't want to create one, at least in the general case.

I *think* this is really just a matter of cooperating with the paste.urlmap 
middleware.  You probably want to pay attention to what paste.urlmap.URLMapper 
does in its __call__ method:

     def __call__(self, environ, start_response):
         host = environ.get('HTTP_HOST', environ.get('SERVER_NAME')).lower()
         if ':' in host:
             host, port = host.split(':', 1)
         else:
             if environ['wsgi.url_scheme'] == 'http':
                 port = '80'
             else:
                 port = '443'
         path_info = environ.get('PATH_INFO')
         path_info = self.normalize_url(path_info, False)[1]
         for (domain, app_url), app in self.applications:
             if domain and domain != host and domain != host+':'+port:
                 continue
             if (path_info == app_url
                 or path_info.startswith(app_url + '/')):
                 environ['SCRIPT_NAME'] += app_url
                 environ['PATH_INFO'] = path_info[len(app_url):]
                 return app(environ, start_response)
         environ['paste.urlmap_object'] = self
         return self.not_found_application(environ, start_response)

E.g. it munges environ['SCRIPT_NAME'] and environ['PATH_INFO'].  Joining some 
combination of those two plus the login_form_url should get you what you need, 
I 
think, right?

- C
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to