[Zope3-dev] Products: Contents View Tab?
Jim Fulton
jim at zope.com
Wed Apr 28 11:45:56 EDT 2004
Ian Beatty wrote:
> Greetings.
>
> I hope this is the right forum to post in. I'm trying to get my mind around
> product development for Zope 3,
This is a bit of a difficult time. We've made lots of changes over the last few
months and the docs haven't caught up yet. :/ This is hard to avoid.
> and I've run into a bit of a sticking point.
> I want to build a content class ('Roster') that's a container (subclass of
> BTreeContainer). I've defined an interface ('IRoster') for it (subclass of
> IContainer).
>
> So I'm trying to add a "Contents" tab to the class' ZMI interface. If I do
> it the way that the "Tutorial for Python Programmers" ('short.pdf')
> suggests, with the 'browser:containerViews' in my configure.zcml file, it
> works -- but I don't know how to have the tab's label be something other
> than the default "Contents".
I should take down the short tutorial (just did:). I'm not really happy
with how it turned out. (I don't regret trying it. :)
...
> On yet another hand, if I follow the Zope 3 Developer's Tutorial ("Step 8:
> Zope Container Framework") and use the 'browser:page' tag, I seem to get the
> tab I want with the name I want. It works, though I can't say I understand
> why.
>
> So I have a solution to my problem, but it's pretty much black magic to me
> why one approach works and the other two don't. That's not a happy place for
> a developer to be. Can anyone share a little enlightenment?
If you actually worked through the previous parts of the tutorial,
it shouldn't be black magic.
<browser:page
name="contents.html"
for=".folder.IContactFolder"
permission="zope.ManageContent"
class="zope.app.browser.container.contents.Contents"
attribute="contents"
menu="zmi_views" title="Contacts"
/>
All of the attributes were explained earlier in the tutorial
and illustrated through examples.
We need to specify:
- The name of the page
- What contenbt types to use it for
- What permission is required to use it
- What class implements it. You can easily
find this class and see what it does
- Either a template or an attribute that implements
tha page. There's something a lille odd here, because
the attribute actually names a template. This is to avoid having
to name the template everywhere. I suppose that
we could specify the template now, for clarity, since most people
will use containerViews anyway.
- Menu settings.
What part of this is magic? It's all very explicit.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list