Re: [web2py] Re: question/suggestion about URL, controller

2010-07-30 Thread Jonathan Lundell
On Jul 30, 2010, at 12:05 AM, mdipierro wrote: > You are right but it only breaks backward compatibility in a case > where things would be misleading. Here are some example: > > # old syntax that still works > URL('a','c','f') > URL(a='a',c='c',f='f') > URL(f='f',r=request) > > #new syntax that

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-30 Thread Michele Comitini
yes 2010/7/30 rochacbruno > I have a lot of code wrote in this sintax, But, ig its wrong, no problem to > replace. > > Will this still works? > > _href=URL(request.application,'plugin_wiki','page',args=[row,]) > > Sent from my iPhone > > On 30/07/2010, at 04:05, mdipierro wrote: > > You are ri

[web2py] Re: question/suggestion about URL, controller

2010-07-30 Thread mdipierro
Yes. Your example will work. The only case in where you would get wrong behaviour if you do: URL('otherapp',r=request) (*) or URL('otherapp','othercontroller',r=request) (**) I.e. if you say the URL is in the current request (r=request) and stil you specify the 'otherapp' and/or the 'othercontro

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-30 Thread rochacbruno
I have a lot of code wrote in this sintax, But, ig its wrong, no problem to replace. Will this still works? _href=URL(request.application,'plugin_wiki','page',args=[row,]) Sent from my iPhone On 30/07/2010, at 04:05, mdipierro wrote: > You are right but it only breaks backward compatibility

[web2py] Re: question/suggestion about URL, controller

2010-07-30 Thread mdipierro
You are right but it only breaks backward compatibility in a case where things would be misleading. Here are some example: # old syntax that still works URL('a','c','f') URL(a='a',c='c',f='f') URL(f='f',r=request) #new syntax that resulted in an error before URL('f') URL('c','f') URL(f='f') URL(c

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-29 Thread Thadeus Burgess
Massimo, you cannot I am sorry but that would break backwards compatibility. Say if in certain apps you have this (in alot of the earlier apps on web2py.com do this too) URL(request.application, 'static', 'logo.png') Or URL(request.application, 'default', 'index') Unfortunately, we cannot re-

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-29 Thread Michele Comitini
thumbs up! 2010/7/30 mdipierro > I took it one step further... > > >>> URL() > /app/default/index > >>> URL('test') > /app/default/test > >>> def test(): return 'test' > >>> URL(test) > /app/default/test > >>> URL('static','filename') > /app/static/filename > >>> URL('other','static','filename')

[web2py] Re: question/suggestion about URL, controller

2010-07-29 Thread mdipierro
I took it one step further... >>> URL() /app/default/index >>> URL('test') /app/default/test >>> def test(): return 'test' >>> URL(test) /app/default/test >>> URL('static','filename') /app/static/filename >>> URL('other','static','filename') /other/static/filename No more r=, c=, f= needed but al

[web2py] Re: question/suggestion about URL, controller

2010-07-29 Thread MikeEllis
Very nice! It does bring up a question I've been meaning to ask: What's the recommended practice for apps to check the web2py version and announce "I need web2py X.XX or greater!" On Jul 29, 10:23 am, VP wrote: > Wow.  Excellent work.  And thank you.

[web2py] Re: question/suggestion about URL, controller

2010-07-29 Thread VP
Wow. Excellent work. And thank you.

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-28 Thread Thadeus Burgess
SORRY! =D -- Thadeus On Wed, Jul 28, 2010 at 6:22 PM, mdipierro wrote: > WOW. Uploading to trunk. Now I need to revise the book again. :-( > > On Jul 28, 5:51 pm, Thadeus Burgess wrote: >> >>> URL(r=request, c='hello', f='world', args=['hi'], >> >>> vars={'q':'greetings'}, anchor='the_worl

[web2py] Re: question/suggestion about URL, controller

2010-07-28 Thread mdipierro
WOW. Uploading to trunk. Now I need to revise the book again. :-( On Jul 28, 5:51 pm, Thadeus Burgess wrote: > >>> URL(r=request, c='hello', f='world', args=['hi'], vars={'q':'greetings'}, > >>> anchor='the_world') > > '/welcome/hello/world/hi#the_world?q=greetings'>>> URL(c='hello', f='world',

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-28 Thread Thadeus Burgess
>>> URL(r=request, c='hello', f='world', args=['hi'], vars={'q':'greetings'}, >>> anchor='the_world') '/welcome/hello/world/hi#the_world?q=greetings' >>> URL(c='hello', f='world', args=['hi'], vars={'q':'greetings'}, >>> anchor='the_world') '/welcome/hello/world/hi#the_world?q=greetings' Attache

[web2py] Re: question/suggestion about URL, controller

2010-07-28 Thread mdipierro
ok On Jul 28, 4:52 pm, Thadeus Burgess wrote: > For a little more advanced version of what Massimo just posted: > > This allows you to use both. > > URL(r=request, c=, f=.) > and > URL(c=, f=.) > > http://packages.python.org/web2py_utils/init.html#gurlhttp://hg.thadeusb.com/Web/web2py_uti

Re: [web2py] Re: question/suggestion about URL, controller

2010-07-28 Thread Thadeus Burgess
For a little more advanced version of what Massimo just posted: This allows you to use both. URL(r=request, c=, f=.) and URL(c=, f=.) http://packages.python.org/web2py_utils/init.html#gurl http://hg.thadeusb.com/Web/web2py_utils/file/697470f78d16/web2py_utils/utils.py#l11 The reason we

[web2py] Re: question/suggestion about URL, controller

2010-07-28 Thread mdipierro
1) It is a bit more complex because of static, appadmin, and admin. You can map /function/var1/var2 into /app/controller/function/var1/var2 using a file routes.py --- begin file routes_in=[ ('/admin/$anything','/admin/$anything'), ('/static/$anything','/app/static/$anything'), ('/app