adding a folder with the id 'home' results in an attribute error

Bug #141252 reported by Eric Casteleijn
2
Affects Status Importance Assigned to Milestone
Silva
Fix Released
Medium
Martijn Faassen

Bug Description

In Silva 1.6 (at least) adding a folder with the id 'home' results in an attribute error. After initial investigation it seems that the mangle id validation fails because the class Folder or one of its ancestors exposes the attribute 'home'. Of course this means that acquisition is looking at the wrong things entirely. It also seems that when adding a folder successfully (i.e. with a different id) the mangle.Id._validate method is called twice for the folder (no I'm not mistakenly looking at the call for the default document, it is in fact called 3 times in total) which is weird.

If we look at mangle.py 197-198:

        attr = getattr(folder.aq_inner, maybe_id, _marker)
        if attr is not _marker:

The first time folder.aq_inner is <Silva Root instance silva>, which is fine (folder.aq_inner.home gives an attribute error), the second time however it is:

<Products.Silva.zcml.handlers.__FactoryDispatcher__ object at 0x95ef1cc>

which is where I'm lost. Why the heck is it called twice? Anyway this is where it goes wrong because now:

folder.aq_inner.home == '/home/eric/instances/plain-1.6/Products/Silva'

i.e. a filesystem path to the Silva Product folder.

questions: why is mangle.Id._validate called twice, and why are its arguments different and *wrong* the second time?

faassen, when you're coming in, I need your help on this.

Changed in silva:
assignee: nobody → faassen
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Martijn Faassen (faassen) wrote :

Okay, it turned out that 'home' was actually reserved but this was un-reserved in 1.6. The same problem existed in Silva 1.5 and likely before too. The FactoryDispatcher has a home attribute and while it acquires everything else from the folder you're inheriting from, the 'home' attribute is there messing things up.

I've re-reserved the things that were unreserved (except for search) in Silva 1.6 branch, Silva 2 branch and trunk.

Changed in silva:
status: Confirmed → Fix Committed
Changed in silva:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.