I cant seem to make this work. I created the file in models and modified a url helper to use it and received the following error:
TypeError: URL() got an unexpected keyword argument 'secure' A few follow up questions: 1. Did you intend to say 'model' rather than module? 2. How do I integrate 0_redefine_url.py into my app such that the URL helper will accept the keyword argument 'secure'? Thanks - Jay On Dec 17, 1:20 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > I do not think it is a idea because would encourage people to use it > and build non-portable applications. > If users were doing that, the applications may break when running on > port 8000 or would break when being a proxy if it where to detect the > port. There is no definitive way for the app to know the public URL. > > Moreover it would only form when called with URL(r=request,...) but > not when called with URL(app,...) because it would have no knowledge > of the request object. > > I think whether to use https and/or https should be handled outside > the application. > > Massimo > > On Dec 16, 10:52 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > > > > > On Dec 16, 2009, at 6:58 PM, Álvaro Justen [Turicas] wrote: > > > > On Thu, Dec 10, 2009 at 20:50, mdipierro <mdipie...@cs.depaul.edu> wrote: > > >> I would suggest creating a model 0_redefine_url.py that contains: > > > >> _URL=URL > > >> def URL(*a,**b): > > >> if not 'secure' in b: > > >> return _URL(*a,**b) > > >> elif b['secure']: > > >> del b['secure'] > > >> return 'https://'+request.env.http_host + _URL(*a,**b) > > >> else: > > >> del b['secure'] > > >> return 'http://'+request.env.http_host + _URL(*a,**b) > > > >> and use URL(....,secure=True), URL(...secure=False) as required > > > > I think this is very useful. Can we add this in trunk? > > > It *would* be useful, I think. If URL() defaults secure=None ... > > > >> Massimo > > > >> 'https://'+request.env.http_host +'/app/default/logon') > > > >> On Dec 10, 2:11 pm, Wes James <compte...@gmail.com> wrote: > > >>> Actually, I don't think it would matter if there were a proxy or not?? > > > >>> On Thu, Dec 10, 2009 at 1:06 PM, Wes James <compte...@gmail.com> wrote: > > >>>> As long as you don't have a proxy between your users and the server > > >>>> something with request.env could be used > > > >>>> def login(): > > >>>> if request.env.port != 443: > > >>>> redirect('https://'+request.env.http_host +'/app/default/logon') > > > >>>> -wes > > > >>>> On Thu, Dec 10, 2009 at 11:42 AM, Jay <j...@unclehenrys.com> wrote: > > >>>>> I am new to web2py and Apache w/mod_ssl and I have been searching > > >>>>> for > > >>>>> a solution related to this topic but I must be missing a basic > > >>>>> understanding of the necessary pieces in order to accomplish this. > > > >>>>> Our web2py apache setup seems to be fine. I can access our app's > > >>>>> pages using both http and https if I manually add the 's' to the url. > > > >>>>> What we are trying to do is smoothly transition from one controller/ > > >>>>> function using http to another using https. > > >>>>> Example, a user arrives athttp://init/default/indexandthenthe > > >>>>> user > > >>>>> selects ‘Login’ and they are sent to https:/init/default/login. We > > >>>>> need some controller functions to use http and some https. Can this > > >>>>> be done from within the controller/function? If not, what is the > > >>>>> ‘best practice’ approach to accomplishing this? > > > >>>>> - Jay > > > >>>>> --- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.