Hi, I'm trying to write a unit test for an old pylons 0.9.7 application. The issue we have is that it's very easy to accidentally hard-code URL paths in our jinja2 templates, which works fine until someone hosts our application at a different prefix (i.e.- hosts it at 'http://localhost/foo/' instead of just 'http://localhost/'). I'm doing this using the default "functional test" setup that paste created for me. I query every controller action, and pass in a custom SCRIPT_NAME like so:
response = self.app.get('/some/url/path', extra_environ={'SCRIPT_NAME' : '/custom_prefix'}) I then use beautifulsoup to parse the document, iterating over all the tags that have an 'href' attribute or a 'src' attribute, and ensure that it starts with '/custom_prefix'. Here's where things get odd: When we pass an absolute path in to "pylons.url" in our templates like this: {{ h.stylesheet_link(h.url('/css/style.css')) }} ...it works perfectly. However, when we call "pylons.url" with keyword arguments like this: {{ h.link_to('Home', h.url(controller='person', action='home')) }} ...the prefix is not inserted. However, the url() function works correctly when running this correctly (i.e.- using mod_wsgi or pastedeploy) with a non-empty SCRIPT_NAME. I guess that I'm missing a critical step, but I can't think what it is. Can anyone on this list shed some light on my predicament? Thanks. -- Thomi Richards -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.