[Zope-dev] Re: SiteRoot and VHM

Laurence Rowe l at lrowe.co.uk
Thu Apr 7 17:55:39 EDT 2005


Paul Winkler wrote:
> On Thu, Apr 07, 2005 at 12:55:09PM +0100, Laurence Rowe wrote:
> 
>>-1 for removing it. I think it's a cool feature :-)
>>
>>I like the ability to use a 'blank' SiteRoot (one with a blank base and 
>>path) in conjunction with an access rule to set request variables when I 
>>access my site in through a particular point (eg set the plone_skin 
>>variable when I access my site through /admin or force a particular 
>>language when I access my site through /language-name). This is in 
>>addition to using VHM and apache rewrite rules in the standard way.
> 
> 
> I'm curious, what does the SiteRoot buy you over just doing all that in 
> an access rule?
>  

Having just read up on  REQUEST.setServerURL(SiteRootBASE) and 
REQUEST.setVirtualRoot(SiteRootPATH). I was about to say "nothing at all 
- I'm just being ignorant", but it looks like the answer is actually 
'flexibility'.

 From http://www.zope.org/Members/4am/SiteAccess2/vhosting

"""
If a SiteRooted folder is ever accessed through URLs with a base or path 
that does not get rewritten to match the Base and Path of the SiteRoot, 
you should make the SiteRoot's Base and Path blank and dynamically 
create SiteRootPATH/SiteRootBASE variables. For example, if you made a 
'Zope' global-access prefix as described above, then the 'else' part 
should contain something like <dtml-call "REQUEST.set('SiteRootPATH', 
'/')">.
"""

Without the blank site root you lose the flexibility of these methods 
working when the site is not being virtual hosted, which is quite handy 
while developing.

Laurence



More information about the Zope-Dev mailing list