Many thanks Danny, My Zope server is behind an Apache server that makes rewrite to www.site1.com:8080 This was my (stupid) mistake. Should have been obvious ! It works now with : machine = _.string.lower(_.string.split(context.REQUEST.HTTP_HOST, ':')[0]) # and so on... The complete accessrule script is : =============== machine = _.string.lower(_.string.split(context.REQUEST.HTTP_HOST, ':')[0]) servermap = { 'www.site1.com': 'folder_site1', 'www.site2.com': 'folder_site2' } if servermap.has_key(machine): context.REQUEST['TraversalRequestNameStack'].append(servermap[machine]) return ============== With the namespace bound to '_' Cheers --Gilles ----- Original Message ----- From: "Danny William Adair" <danny@adair.net> To: "Gilles Lenfant" <glenfant@bigfoot.com>; <zope@zope.org> Sent: Wednesday, October 03, 2001 12:07 AM Subject: Re: [Zope] An accessrule in python script
Hi Gilles,
if your current script looks exactly like this: ---------------------------------------------------------------- from string import lower request = container.REQUEST machine = lower(request.HTTP_HOST) servermap = { 'www.site1.com': 'site1', 'www.site2.com': 'site2' } if servermap.has_key(machine): request['TraversalRequestNameStack'].append(servermap[machine]) ----------------------------------------------------------------
and fails, then something odd is going on. I don't see any mistake.
Hold on...
If you're running Zope on a port other than 80, machine = lower(split(request.HTTP_HOST, ':')[0]) should do the trick (to get rid of the :port) I recognized you had used that in your DTML.
Did you "re"-set the access rule?