If the web server provides the functionality to rewrite the output
URLs, I'd use it.

If not I would use routes.py

What I am not comfortable with (but I may be missing something here)
it implementing the request.env.script_name in URL since the output of
URL is already rewritten by module rewrite.py based on routes.py.

In any case I think the comment you refer to is in the old manual.
routes has grown over time and I no longer discourage its use.

Massimo

On Sep 5, 3:31 pm, Joe Barnhart <[email protected]> wrote:
> What is the role of routes.py in a production environment?  In the book, you
> seemed to indicate that routes.py was not the solution of choice:
>
> "All major web servers, for example Apache and lighttpd, also have the
> ability to rewrite URLs. In a production environment we suggest having the
> web server perform URL rewriting."
>
> So are we supposed to use routes.py to fix issues like this, or not?  It
> seems conflicting to say now that routes.py is the accepted way to do URL
> rewriting in mod_wsgi under Apache.
>
> -- Joe B.
>
> On Sat, Sep 5, 2009 at 11:04 AM, mdipierro <[email protected]> wrote:
>
> > I should add that this is not a closed issue.
>
> > Graham has a valid point and we need to find a way that makes
> > everybody happy.  I would like to hear an argument about why this does
> > not break backward compatibility (I think it does if people already
> > use routes for this purpose) and about what is wrong with using routes
> > for this.
>
> > Massimo
>
> > On Sep 5, 12:55 pm, mdipierro <[email protected]> wrote:
> > > I am not convinced. I had added this in trunk but I am taking it out
> > > because this is not the right solution to the problem and because it
> > > does break backward compatibility.
>
> > > 1) You can relocate web2py in a subfolder but you must use routes.py
> > > 2) The patch does break backward compatibility if a user is already
> > > using routes.py for this purpose
> > > 3) I do not like the fact that web2py treats input URLs differently
> > > than output URLs. If any url rewrite has to be made this should be
> > > done at the level of routes.py (the configuration for the rewrite.py
> > > module).
>
> > > It is very easy
>
> > > #in routes.py
> > > routes_out=(('(?P<anything>.*)','/yourpath\g<anything>'),)
>
> > > Massimo
>
> > > On Sep 5, 12:07 pm, Joe Barnhart <[email protected]> wrote:
>
> > > > +1 for Graham.
>
> > > > Backward compatibility is not broken because relocating the web2py site
> > in
> > > > the directory structure is a new feature.  If you want to take
> > advantage of
> > > > the new feature, you just re-code your URL functions.  Old
> > installations
> > > > work as they always did.  (Also - can we call w2p "enterprise" if it
> > doesn't
> > > > play nice with other WSGI apps?)
>
> > > > -- Joe B.
>
> > > > On Fri, Sep 4, 2009 at 2:59 AM, Graham Dumpleton <
> > [email protected]
>
> > > > > wrote:
>
> > > > > On Sep 4, 4:26 pm, mdipierro <[email protected]> wrote:
> > > > > > I think we can modify your patch so that it does not require
> > r=request
> > > > > > (which would break some apps)
>
> > > > > Why would requiting r=request for URL calls break some applications?
>
> > > > > The code for URL is:
>
> > > > >    application = controller = function = None
> > > > >    if r:
> > > > >        application = r.application
> > > > >        controller = r.controller
> > > > >        function = r.function
> > > > >    if a:
> > > > >        application = a
> > > > >    if c:
> > > > >        controller = c
> > > > >    if f:
> > > > >        if isinstance(f, str):
> > > > >            function = f
> > > > >        else:
> > > > >            function = f.__name__
>
> > > > >    if not (application and controller and function):
> > > > >        raise SyntaxError, 'not enough information to build the url'
>
> > > > > So supplying it where it wasn't previously shouldn't matter that I
> > can
> > > > > see as previously for it to work the called would have had to provide
> > > > > a, c and f. If they are doing that they would still override what is
> > > > > specified by the request object.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to