On Tue, Apr 14, 2009 at 12:27 PM, ceej <cjlaz...@googlemail.com> wrote: > > any ideas? > > Thank you in advance :) > > On Apr 14, 1:42 am, ceej <cjlaz...@googlemail.com> wrote: >> I've noticed that if I have mydomain.com/http://google.com?a=testit >> will ignore a in path, is there anyway in routes I can convert ? to >> safe text? I've created a tinyurl.com but better in web2py. This is my >> last problem before I update the look and make it opensource :) >> >> say if you are athttp://google.comjust type cj.nu/ infront like >> cj.nu/http://google.comit will create a url likehttp://cj.nu/a:) >> >> On Apr 13, 7:07 pm, ceej <cjlaz...@googlemail.com> wrote: >> >> > I did it: >> >> > routes_in=( >> > ('/admin(?P<stuff>.*)', '/admin\g<stuff>'), >> > ('/static(?P<stuff>.+)', '/cj/static\g<stuff>'), >> > ('/(?P<controller>error|blog|auth)', '/cj/$controller/index'), >> > ('/cj/(?P<stuff>.+)', '/cj/\g<stuff>'), >> > ('^.*:/$', '/cj/main/index'), >> > ('/(?P<args>.+)', '/cj/main/index/$args'), >> > ) >> > routes_out=( >> > ('/admin(?P<stuff>.*)', '/admin\g<stuff>'), >> > ('^/cj/main/index$','/'), >> > ('/cj/(?P<stuff>.+)', '/\g<stuff>'), >> > ) >> >> > One other thing though, i know doing mydomain.com/google.com works but >> > how would I make mydomain.com/http://google.comworkwithout getting >> > invaild request?
I tried with query strings and it don't work. I think it is a web2py bug: web2py don't handles query strings in routes.py (like I tested). Example: ('/Test(?P<all>.+)$', '/myapp/default/padrao?\g<all>'), If I enter in http://localhost:8000/TestAlvaro?Justen web2py matches that rule and process function "padrao" in controller "default" of "myapp" with request.env.request_uri "/myapp/default/padrao?Alvaro". I tried with: ('/Test(?P<all>[^\?]+)?(?P<qs>.+)$', '/myapp/default/padrao?url=\g<all>&qs=<qs>'), and it didn't work too. Massimo, as I requested in other thread[1], I think we can improve routes.py with: - Creating a var with full requested URL. It can solve ceej problem specifically and my problem (as I reported), but don't solve full problem: web2py can't handle query strings in routes.py; - Add the functionality to routes.py handle query strings and - Provide an way to do not raise an exception if a regex is not matched. I think it can pass "" (None) to that pattern. Example: if I have only one rule, like this: ('/Test(?P<all>[^\?]+)\??(?P<qs>.+)?$', '/myapp/default/padrao?url=\g<all>&qs=<qs>'), The ?P<qs> is something optional, but in web2py, if user enter in localhost:8000/TestAlvaro, it raises and exception, because <qs> wasn't matched. -- Ceej, temporaly I think that you have to use Apache .htaccess to redirect requests that starts with ?http://... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^?http://([0-9]+)/.*$ /myapp/default/padrao?url_with_qs=$1 [L,QSA] I didn't tried this. -- Álvaro Justen Peta5 - Telecomunicações e Software Livre 21 3021-6001 / 9898-0141 http://www.peta5.com.br/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---