[Zope-CMF] Re: Make CMF root of site?

Dan L. Pierson dan@control.com
Fri, 06 Jul 2001 15:49:44 -0400


--==========940360887==========
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline



--On Friday, July 06, 2001 09:04:08 AM -0700 Simon Michael 
<simon@joyful.com> wrote:

> "Dan L. Pierson" <dan@control.com> writes:
>> We're running naked ZServer instead of Apache at the moment so I've
>> got a SiteRoot with all properties set to '' in each CMF folder and
>> a site access rule in the root that sets things up for the correct
>> folder/SiteRoot based on incoming host name.  It's a little more
>> complicated to set up the first time but very clear and easy to
>> maintain once you get it going.
>
> Hi Dan - I'd really like to see this, would you be willing to post
> your rule ?

Ask and you shall receive:




--==========940360887==========
Content-Type: text/plain; charset=us-ascii; name="quintus_access_rule.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="quintus_access_rule.py"; size=988

## Script (Python) "access_rule"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
#context.log_('access rule entered')
req = context.REQUEST
stack = req['TraversalRequestNameStack']

if stack and stack[-1] == 'Z':
    stack.pop()
    req.setVirtualRoot('Z')
else:
    if req.has_key('HTTP_HOST'):
        host = req['HTTP_HOST']
    else:
        host = 'quintus.control.com'

    vhost_folder = []
    if host in ['www.puffinscada.org', 'puffinscada.control.com']:
        vhost_folder = ['puffin_scada']
    elif host in ['www.puffinplc.org', 'puffinplc.org', 
                  'www.linuxplc.org', 'linuxplc.control.com', 
                  'puffinplc.control.com']:
        vhost_folder = ['puffin_plc']

    #context.log_('access rule goto %s' % `vhost_folder`)
    if vhost_folder:
        vhost_folder.reverse()
        stack.extend(vhost_folder)
        req.set('SiteRootPATH', '/')
--==========940360887==========--