On Sep 3, 10:51 am, Adam Atlas <[EMAIL PROTECTED]> wrote:
> On 2 Sep 2007, at 18:40, Graham Dumpleton wrote:
>
> > I ask as it isn't a standard CGI variable, nor required by WSGI. It
> > seems perhaps to be a hack to workaround problems with some WSGI
> > adapters which doesn't set SCRIPT_NAME correctly.
>
> Actually it's a hack to workaround problems with some WSGI adapters
> which *do* set SCRIPT_NAME properly. That is, to /whatever/blah.wsgi.
> That's all well and good, but it's used by some functions such as
> web.url, and then you end up with the generated URLs starting with /
> whatever/blah.wsgi/..., which I don't want, because I'm trying to
> mod_rewrite that bit away.

So, if I understand you right, since web.py effectively predated WSGI
it did things in its own way but when WSGI came along a WSGI adapter
would set things up in a different way to what web.py expected and
thus this fiddle is required. Yes/No? Or is it more to do with the
specific rewrite requirement you have?

BTW, if using mod_wsgi, you could always do:

  _application = web.wsgifunc(web.webpyfunc(urls, globals()))

  def application(environ, start_response):
    environ['SCRIPT_NAME'] = environ['REAL_SCRIPT_NAME']
    return _application(environ, start_response)

Ie., just do the adjustment yourself.

You could even hard code REAL_SCRIPT_NAME value in the script itself,
although if you are using mod_rewrite magic to set REAL_SCRIPT_NAME
variable on the fly, better to grab it from environment.

Graham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to