Accessrule and site root folder "in the depth" of the zope tree
Hi, As you can see in the nexts script (accessrule), I want all request to www.site2.com to start from the Zope folder "somewhere/site2" (2nd level of ZODB tree) but it does not work when it works for site1 (like all others at first level of ZODB tree). Is there something I missed (I'm sure I did but what... :)). Thanks in advance. --Gilles ================ servermap = { 'www.site1.com': 'site1', 'www.site2.com': 'somewhere/site2' } machine = _.string.lower(_.string.split(context.REQUEST.HTTP_HOST, ':')[0]) if servermap.has_key(machine): context.REQUEST['TraversalRequestNameStack'].append(servermap[machine]) return
Hi Gilles! The TraversalRequestNameStack is a list (handled like a stack) and holds the object ids separately. If you access "myObject" in the subfolder "mySubfolder" underneath the Zope root folder for example, the TraversalRequestNameStack will look like this: ['myObject','mySubFolder'] (yes, in reverse order) An object with the id 'somewhere/site2' does not exist, so you would have to append two string to the list... In your case, I would not "append" a single item to a list, but append a whole list to a list, with single items being lists with one item: servermap = { 'www.site1.com': ['site1'], 'www.site2.com': ['site2','somewhere'] } machine = _.string.lower(_.string.split(context.REQUEST.HTTP_HOST, ':')[0]) if servermap.has_key(machine): context.REQUEST.set('TraversalRequestNameStack', context.REQUEST['TraversalRequestNameStack']+servermap[machine]) return Again, keep in mind the reverse order inside your lists. Of course you could make this a little more elegant, since you call context.REQUEST['TraversalRequestNameStack'] twice. hth, Danny On Saturday 13 October 2001 07:51, Gilles Lenfant wrote:
Hi,
As you can see in the nexts script (accessrule), I want all request to www.site2.com to start from the Zope folder "somewhere/site2" (2nd level of ZODB tree) but it does not work when it works for site1 (like all others at first level of ZODB tree). Is there something I missed (I'm sure I did but what... :)).
Thanks in advance.
--Gilles
================ servermap = { 'www.site1.com': 'site1', 'www.site2.com': 'somewhere/site2' } machine = _.string.lower(_.string.split(context.REQUEST.HTTP_HOST, ':')[0]) if servermap.has_key(machine): context.REQUEST['TraversalRequestNameStack'].append(servermap[machine]) return
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Danny, Thanks for the hint but since my post, I successfully switched to the VirtualHostMonster to get rid of this kind of problem. --Gilles ----- Original Message ----- From: "Danny William Adair" <danny@adair.net> To: "Gilles Lenfant" <glenfant@bigfoot.com>; <zope@zope.org> Sent: Monday, October 15, 2001 10:54 PM Subject: Re: [Zope] Accessrule and site root folder "in the depth" of the zope tree
Hi Gilles!
The TraversalRequestNameStack is a list (handled like a stack) and holds the object ids separately. If you access "myObject" in the subfolder "mySubfolder" underneath the Zope root folder for example, the TraversalRequestNameStack will look like this:
['myObject','mySubFolder']
(yes, in reverse order)
participants (2)
-
Danny William Adair -
Gilles Lenfant