That is fine and may serve a purpose.
On Mar 10, 11:33 pm, NguyendHEX <[email protected]> wrote:
> thanks,
>
> how about change '_' to '-' in routes_out?
>
> On Mar 11, 11:17 am, mdipierro <[email protected]> wrote:
>
> > all spaces and dashes are automatically mapped into _ so there is
> > nothing you need to do.
>
> > On Mar 10, 9:52 pm, NguyendHEX <[email protected]> wrote:
>
> > > Regarding to using '-' in URL, i can manual map them
>
> > > routes_in = (('.*:/users/sign-in/', '/tools/default/sign_in')) (it
> > > works fine)
>
> > > but i don't know how to map all of them by an expression.
>
> > > On Mar 11, 1:03 am, Jim <[email protected]> wrote:
>
> > > > There's a slight typo when it starts up: it's looking for routes.py
> > > > but says
>
> > > > WARNING:root:URL rewrite is on. configuration in route.py
>
> > > > when it should be routes.py Looking through the source code in /
> > > > gluon it's clearly looking for routes.py so it's not a bug.
>
> > > > On Mar 10, 10:45 am, NguyendHEX <[email protected]> wrote:
>
> > > > > ah, yes, i usually restart web2py every time i change routes.py ;)
>
> > > > > On Mar 11, 12:36 am, Michael Wales <[email protected]> wrote:
>
> > > > > > Server restart! I'm not sure if this is documented somewhere but I
> > > > > > never did find it. Restarted my service and all is working perfectly
> > > > > > fine (speaking of which, the dashes work fine - the translation to
> > > > > > underscores must be *way* behind the scenes).
>
> > > > > > Thanks for all the help!
>
> > > > > > On Mar 10, 1:01 pm, Michael Wales <[email protected]> wrote:
>
> > > > > > > Changing the - to _ inroutes.py(and of course, altering the data
> > > > > > > in
> > > > > > > the table, to correspond) still results in an "invalid function"
> > > > > > > error.
>
> > > > > > > I want to say myroutes.pyisn't being seen/used at all! For
> > > > > > > instance,
> > > > > > > routes_out doesn't seem to be doing anything either. This line
> > > > > > > doesn't
> > > > > > > rewrite any of the URL() calls that you would think it should:
> > > > > > > routes_out = (('.*:/shooterhero/default/index', '/shooterhero'))
>
> > > > > > > My routes file is C:\web2py\routes.pyand web2py is running as a
> > > > > > > service.
>
> > > > > > > On Mar 10, 11:27 am, mdipierro <[email protected]> wrote:
>
> > > > > > > > I think the problem is that web2py does not '-' in URL and
> > > > > > > > replaces
> > > > > > > > them with '_'. the replacement should happen after the URL
> > > > > > > > mapping and
> > > > > > > > before your action is called. Your actions sees "quake_like"
> > > > > > > > instead
> > > > > > > > of "quake-live". Does this help?
>
> > > > > > > > Massimo
>
> > > > > > > > On Mar 10, 10:08 am, Michael Wales <[email protected]> wrote:
>
> > > > > > > > > Yeah, that's exactly how my app is setup at the moment (this
> > > > > > > > > is in
> > > > > > > > > controllers/games.py):
>
> > > > > > > > > def view():
> > > > > > > > > sqlGame = db(db.games.slug ==
> > > > > > > > > request.args[0]).select()
> > > > > > > > > game = sqlGame[0]
> > > > > > > > > sqlPeople = db((db.games_people.game_id == game.id) &
> > > > > > > > > (db.games_people.person_id == db.people.id)).select()
> > > > > > > > > sqlCompanies = db((db.companies_games.game_id ==
> > > > > > > > > game.id) &
> > > > > > > > > (db.companies_games.company_id == db.companies.id)).select()
>
> > > > > > > > > response.title = game.title + ' - ' + response.title
> > > > > > > > > return dict(game = game, people = sqlPeople,
> > > > > > > > > companies =
> > > > > > > > > sqlCompanies)
>
> > > > > > > > > The method in the controller is fine, as visiting
> > > > > > > > > /shooterhero/games/
> > > > > > > > > view/quake-live works as expected.
>
> > > > > > > > > I also tried changing "quake-live" to "quake" within the
> > > > > > > > > routes - just
> > > > > > > > > for testing purposes. With "quake-live" I get an "Invalid
> > > > > > > > > request"
> > > > > > > > > error, with "quake" I get an "invalid function" error.
>
> > > > > > > > > On Mar 10, 10:50 am, mdipierro <[email protected]>
> > > > > > > > > wrote:
>
> > > > > > > > > > You are mapping into
>
> > > > > > > > > > '/shooterhero/games/view/quake-live'
>
> > > > > > > > > > this assumes you app is called shooterhero
> > > > > > > > > > your controller is called games.py
> > > > > > > > > > your controller contains an action
>
> > > > > > > > > > def view():
> > > > > > > > > > ....
>
> > > > > > > > > > which parses "quake-live" from request.args[0]
>
> > > > > > > > > > Is this really what your app does? If not, how is the
> > > > > > > > > > action called?
>
> > > > > > > > > > On Mar 10, 7:56 am, Michael Wales <[email protected]>
> > > > > > > > > > wrote:
>
> > > > > > > > > > > No luck - I've tried virtually every combination of
> > > > > > > > > > > with/without
> > > > > > > > > > > escaping the dash, with/without the catch-all from the
> > > > > > > > > > > request domain
> > > > > > > > > > > and with/without the application's subdirectory.
>
> > > > > > > > > > > Maybe someone has aroutes.pyfile they can share that I
> > > > > > > > > > > can review?
>
> > > > > > > > > > > On Mar 9, 11:11 pm, mdipierro <[email protected]>
> > > > > > > > > > > wrote:
>
> > > > > > > > > > > > I think the problem is that - musy be escaped \-
> > > > > > > > > > > > You do not need the .*:
>
> > > > > > > > > > > > On Mar 9, 7:00 pm, Michael Wales <[email protected]>
> > > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > I've created aroutes.pywith the following (yes, these
> > > > > > > > > > > > > will become
> > > > > > > > > > > > > RegEx, but I am just trying to get it to work at this
> > > > > > > > > > > > > point):
>
> > > > > > > > > > > > > routes_in = (('.*:/shooterhero/games/quake-live',
> > > > > > > > > > > > > '/shooterhero/games/
> > > > > > > > > > > > > view/quake-live'))
>
> > > > > > > > > > > > > My thinking is, if I link to
> > > > > > > > > > > > > /shooterhero/games/quake-live/ it will
> > > > > > > > > > > > > send this request to the games controller, view
> > > > > > > > > > > > > function, with quake-
> > > > > > > > > > > > > live as args[0] - unfortunately, I get an "Invalid
> > > > > > > > > > > > > request" error.
>
> > > > > > > > > > > > > I know it must be something simple I am overlooking -
> > > > > > > > > > > > > I've tried with/
> > > > > > > > > > > > > without the application directory, same results.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---