SORRY! =D

--
Thadeus





On Wed, Jul 28, 2010 at 6:22 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> WOW. Uploading to trunk. Now I need to revise the book again. :-(
>
> On Jul 28, 5:51 pm, Thadeus Burgess <thade...@thadeusb.com> 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', 
>> args=['hi'], vars={'q':'greetings'}, anchor='the_world')
>>
>> '/welcome/hello/world/hi#the_world?q=greetings'
>>
>> Attached is the diff
>>
>> This should not effect any current usages of URL, but from this point
>> forward we shouldn't have to specify r=request!
>>
>> --
>> Thadeus
>>
>> On Wed, Jul 28, 2010 at 5:21 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
>> > ok
>>
>> > On Jul 28, 4:52 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
>> >> For a little more advanced version of what Massimo just posted:
>>
>> >> This allows you to use both.
>>
>> >> URL(r=request, c=<controller>, f=.....)
>> >> and
>> >> URL(c=<controller>, f=<function>.....)
>>
>> >>http://packages.python.org/web2py_utils/init.html#gurlhttp://hg.thade......
>>
>> >> The reason we have to pass the request to URL each time is because it
>> >> is just imported into the context. Since it is just a python function,
>> >> it has no knowledge of request.
>>
>> >> Why can't we do something like gURL from within web2py? When building
>> >> the context, why can't we make URL a loaded function that will get
>> >> request passed to it, exactly how gURL works.
>>
>> >> Effectively, we won't have to pass request into URL function anymore... 
>> >> ever.
>>
>> >> If your interested, I can work on the patch.
>>
>> >> --
>> >> Thadeus
>>
>> >> On Wed, Jul 28, 2010 at 3:56 PM, mdipierro <mdipie...@cs.depaul.edu> 
>> >> wrote:
>> >> > 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'),
>> >> >  ('/appadmin/$anything','/app/appadmin/$anything'),
>> >> >  ('/$anything','/app/default/$anything'),
>> >> > ]
>> >> > routes_out=[(y,x) for (x,y) in routes_in]
>> >> > ----- end file
>>
>> >> > 2) in db.py define
>>
>> >> > def url(f,args={},vars={}):
>> >> >      return URL(r=request,f=f,args=args,vars=vars)
>> >> > def go(f,args={},vars={},flash=''):
>> >> >      session.flash=flash
>> >> >      return go(url(f=f,args=args,vars=vars))
>>
>> >> > and use
>>
>> >> >    url('index')
>>
>> >> > or
>>
>> >> >   go('index',flash='you are being redirected')
>>
>> >> > I do it all the time
>>
>> >> > On Jul 28, 3:29 pm, VP <vtp2...@gmail.com> wrote:
>> >> >> I'm a newbie, so my questions probably have easy answers, but anyway.
>> >> >> Among a few things, there are two I don't understand and think can be
>> >> >> simplified.
>>
>> >> >> 1. this url:   app/controller/function/var1/var2
>>
>> >> >> For me at least, most of the time I probably have only one
>> >> >> controller.   If there is one controller, may be we should get rid of
>> >> >> "controller" in the url?    This will be sufficient: app/f/a/b/c
>>
>> >> >> 2.  Similarly, most of the time I have only one app (current app).
>> >> >> But I use URL() a lot and every time I have to pass in request like
>> >> >> this URL(r=request, f='foo').
>>
>> >> >> Why do I have to pass in request if I have only one app, one
>> >> >> controller?
>>
>> >> >> Furthermore, isn't request supposed to be global?  If so, do we have
>> >> >> to pass it in?
>>
>>
>>
>>  url_proxy.diff
>> 1KViewDownload
>

Reply via email to