Does this look better:

        # set up routes
        config = request_config()
        config.mapper = mapper
        config.environ = environ
        route = config.mapper_dict

        if route is None:
            response = HTTPNotFound()
            return response(environ, start_response)

        # route redirect function
        def _redirect(url):
            response = HTTPSeeOther(location=url)
            return response
        config.redirect = _redirect

On May 6, 7:10 pm, Justin <[EMAIL PROTECTED]> wrote:
> Thats awesome, thank you for your help!
>
> - Justin
>
> On May 6, 6:42 pm, Ben Bangert <[EMAIL PROTECTED]> wrote:
>
> > On May 6, 2008, at 3:33 PM, Justin wrote:
>
> > >        config = request_config()
> > >        config.mapper = mapper
> > >        config.mapper_dict = route
> > >        config.host = environ['HTTP_HOST']
> > >        config.protocol = environ['SERVER_PROTOCOL']
> > >        config.redirect = _redirect
>
> > > I think the issue is related to the line "config.protocol =
> > > environ['SERVER_PROTOCOL']". Am I passing the wrong environment
> > > variable to config.protocol?
>
> > Yep, however its actually easier to set it up than that. If you merely  
> > set the environ, it'll setup the host and protocol data for you. You  
> > can do this:
>
> > config.mapper = mapper
> > config.environ = environ
>
> > Setting environ automatically sets up the rest, and does the matching,  
> > so after that you can do:
>
> > match = config.mapper_dict
> > route = config.route
>
> > etc.
>
> > At which point, the host and protocol will be set appropriately. If  
> > you really wanted to manually set everything, protocol is looking for  
> > 'http' or 'https', which is the environ['wsgi.url_scheme'] variable.
>
> > Cheers,
> > Ben
>
> >  smime.p7s
> > 3KDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to