This is mainly a note for others looking to do the same. I'm sure this is documented somewhere, but I thought I'd put it here (mainly for my own record!).
I needed to set a specific view for a folder in Plone. I had created a view called 'registration' that was configured via a grok directive:
class RegistrationForm(form.SchemaForm):
grok.name('registration')
grok.require('zope2.View')
grok.context(IRegistrationFolder)
schema = IAttendee
ignoreContext = True
label = _(u"Register for Plone Conference 2010")
description = _(u"A description about the registration")
....
I then created a marker interface in interfaces.py:
from zope.interface import Interface
class IRegistrationFolder( Interface ):
""" marker interface for the registration folder """
I then created a regular Folder in Plone called 'Registration' and published it. I then went into the Zope Management Inferface and found the folder and then clicked on the 'Interfaces' tab and then checked the checkbox by 'netsight.ploneconf2010_registration.interfaces.IRegistrationFolder' and hit 'Add'.
This then allows me to go to /registration/@@registration and get my view on that folder.
However I wanted to go one step further and make @@registration the default view for the folder so that I can just go to /registration and show my new view. Geir Baekholt pointed out to me on #plone on IRC that the default view name is stored in a property on the folder called 'layout'.
So I went back to the ZMI to my folder and clicked on the 'Properties' tab and added a string property called 'layout' and set it to '@@registration'.
Now when I go to /registration (or click on 'Registration' in the navigation on the site) I get my custom view.
Nice and easy, and not need to subclass Folder just to add a default view, or create a RegistrationsFolder content type.
