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 <[email protected]> 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?

Reply via email to