Hi Graham,
I do not think this is necessary. You can just create a routes.py file
in the web2py folder and write in it
routes_in=(('/grahamd/(?P<any>.*)','/\g<any>'),)
routes_out=(('/(?P<any>.*)','/grahamd/\g<any>'),)
we have been using this for pycon registration for example.
On Sep 3, 11:19 pm, Graham Dumpleton <[email protected]>
wrote:
> At the moment, web2py will only work if mounted at root of the web
> site. Thus, using Apache/mod_wsgi you can only say:
>
> WSGIScriptAlias / /Users/grahamd/Testing/web2py/wsgihandler.py
>
> You cannot say:
>
> WSGIScriptAlias /subdir /Users/grahamd/Testing/web2py/wsgihandler.py
>
> Since web2py seems to perform all URL construction for purposes of
> links using URL, only one code change appears to be required in web2py
> core to allow this to work. This is to the gluon.html.URL().
>
> *** html.py.dist 2009-09-04 14:05:02.000000000 +1000
> --- html.py 2009-09-04 14:06:48.000000000 +1000
> ***************
> *** 182,188 ****
> if vars:
> other += '?%s' % urllib.urlencode(vars)
>
> ! url = '/%s/%s/%s%s' % (application, controller, function, other)
>
> if regex_crlf.search(url):
> raise SyntaxError, 'CRLF Injection Detected'
> --- 182,192 ----
> if vars:
> other += '?%s' % urllib.urlencode(vars)
>
> ! if r and r.env.script_name:
> ! url = '%s/%s/%s/%s%s' % (r.env.script_name, application,
> ! controller, function, other)
> ! else:
> ! url = '/%s/%s/%s%s' % (application, controller, function,
> other)
>
> if regex_crlf.search(url):
> raise SyntaxError, 'CRLF Injection Detected'
>
> Alas, because this is needing to access SCRIPT_NAME from original WSGI
> environment, for this to work properly will require that 'request'
> also be supplied in all cases where URL is used for URL
> reconstruction.
>
> For example, currently the 'welcome/views/default/index.html' page
> says:
>
> {{extend 'layout.html'}}
>
> {{try:}}{{=H2(message)}}{{except:}}{{=BEAUTIFY(response._vars)}}
> {{pass}}
>
> {{=P(A(T("click here for the administrative interface"), _href=URL
> ('admin','default','index')),_style="padding-top:1em;")}}
> {{=P(A(T("click here for online examples"), _href=URL
> ('examples','default','index')))}}
>
> This needs to be changed to:
>
> {{extend 'layout.html'}}
>
> {{try:}}{{=H2(message)}}{{except:}}{{=BEAUTIFY(response._vars)}}
> {{pass}}
>
> {{=P(A(T("click here for the administrative interface"), _href=URL
> ('admin','default','index', r=request)),_style="padding-top:1em;")}}
> {{=P(A(T("click here for online examples"), _href=URL
> ('examples','default','index', r=request)))}}
>
> This will ensure that URL() has access to request object and so is
> able to insert into the URL the value of SCRIPT_NAME, representing the
> mount point of the WSGI application.
>
> I don't know enough about web2py to know if there are other situations
> where it would also be required to pass request object to ensure this
> is all done correctly. Internally I think the core code always passes
> through request object, so problem is more likely to be HTML templates
> for views.
>
> Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---