OK this one might seem very redundant but it just doesn't work on my
behalf. I have an existing controller with an address like this:

/resume/default/public/

which shows the public view of the online resume. I wish to make a
simpler url for users to spread their resumes to, so I made a table to
hold user codes and a controller to pass on the information to the
controller mentioned above:
*************
def cv():
    if auth.user is None and request.args(0) is None:
        redirect(URL('index'))
    resumeurl =
db(db.resumeurl.code==request.args(0)).select().first()
    if resumeurl is None:
        redirect(URL('public'))
    user = db(db.auth_user.id==resumeurl.owner).select().first()
    redirect(URL('public/'+str(user.id)))
*************
so when I do:
cvstash.com/resume/default/cv/usercode

it redirects fine and has no problems. Now I wish to shorten the
distributable url to something like:
cvstash.com/view/usercode

so I made web2py/routes.py with this code:
*************
routers = dict(
  BASE  = dict(default_application='resume'),
)
routes_in = (
  ('/view/', '/resume/default/cv/'),
  (r'/view/<any>', r'/resume/default/cv/(?P<any>.*)'),
)
*************
The first part which maps the default controller works fine, but the
second one which should do the shortening of the url doesn't work at
all (says invalid request). I copied the first routes_in entry
directly from the book. Any thoughts?

Reply via email to