Personal tools
You are here: Home Development SKEN How To's How To Fix Strange Behavior in accessRule.py
Document Actions

How To Fix Strange Behavior in accessRule.py

by ploneadmin last modified 2005-08-10 14:53
The original accessRule.py delivered with Plone in INSTANCE/Products/CMFPlone/Extensions looks like this :

    import os
    HTTP_MANAGE = os.environ.get('HTTP_MANAGE', '')
    siteObj = 'Plone'

    def accessRule(self, *args):
        if self.REQUEST.get('SERVER_PORT', '') != HTTP_MANAGE and self.REQUEST['URL'].find(siteObj) < 0:
            self.REQUEST['TraversalRequestNameStack'].append(siteObj)
            self.REQUEST.set('SiteRootPATH', '/')

Unfortunately, it occasionally introduces extra /Plone nodes in the URL, so we make a copy in the INSTANCE/Extensions directory and make the following simple change to correct the problem :

    import os
    HTTP_MANAGE = os.environ.get('HTTP_MANAGE', '')
    siteObj = 'Plone'

    def accessRule(self, *args):
        if self.REQUEST.get('SERVER_PORT', '') != HTTP_MANAGE and
\
           self.REQUEST['TraversalRequestNameStack'].count(siteObj) < 1 and \
           self.REQUEST['URL'].find(siteObj) < 0:

            self.REQUEST['TraversalRequestNameStack'].append(siteObj)
            self.REQUEST.set('SiteRootPATH', '/')



See How To Build Plone From Source for information on how to activate the access rule script.
« October 2008 »
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: