[Zope-CMF] Where does a folder view come from?

Michael McLay mclay@nist.gov
Fri, 14 Feb 2003 16:50:21 -0500

On Friday 14 February 2003 03:33 pm, Greg Ward wrote:
> I'm not sure if this is a Zope question or a CMF question, but here
> goes: where is the page for "/foo" generated if "/foo" is a folder?  (In
> this case it's a CMF PortalFolder.)  My problem is that "/foo" is
> brand-new and doesn't have an "index_html" document -- so somebody is
> acquiring "/index_html" and showing it for the "/foo" view.  Yuck.
> I would have thought that the absence of "/foo/index_html" would mean
> Zope would show me a contents page for "/foo", but that doesn't seem to
> be the case.  Diving into portal_types/Folder, it looks like there is no
> action defined for "view" -- and this is backed up by
> factory_type_information in CMFCore/PortalFolder.py.  So some code
> somewhere is making the decision to look for "index_html" and acquiring
> it from "/" ... but what code?  where?

The Action link in the menu is defined in the Action tab for the portal_type. 
For some reason the default for View is not defined and as a result it uses 
aquisition to fill in the closest defined index_html web page. To fix the 
problem just define a view Action for the Folder type. Go to the Action tab 
in  /YourCCMFSite/portal_types/Folder and create a name for for the View 
Action. I used "folder_view_form".

Then create a Python script called  

Here's a very broken script, but it will get you started in building something 
that will display the contents of the folder. (I'd finish it before posting, 
but they will be turning power off in our building in about 20 minutes and 
I've got to power down.)

from Products.PythonScripts.standard import html_quote
request = container.REQUEST

print container

print traverse_subpath

print "contains :%s:" % container.contentIds()

#print container.REQUEST
# Return a string identifying this script.
print "This is the", script.meta_type, '"%s"' % script.getId(),
if script.title:
    print "(%s)" % html_quote(script.title),
print "in", container.absolute_url()
return printed