René Pijlman wrote:

Is there a way to have the test runner use VirtualHostBase, and get urls
that are the same as with interactive use through Apache and
VirtualHostBase?

Or is the custom solution to write the tests as if using Zope directly,
without Apache and VirtualHostBase?

Yes, and yes. :-)

Virtual hosting is done by Zope, when it sees a "magic" URL. So you could construct your testbrowser URLs like

http://nohost/VirtualHostBase/http/nohost:80/plone/VirtualHostRoot/<whatever>

This is exactly what a rewrite rule in Apache does. Zope would then see this and generate its URLs (e.g. via absolute_url()) as http://nohost/<whatever>

That said, if your code *assumes* a certain kind of virtual hosting, it's probably broken. In general, you can never be sure about how virtual hosting is being used. You should use things like absolute_url() or request.physicalPathToURL() to generate URLs that adequately take virtual hosting into account.

Martin


--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to