[Zope3-dev] Re: Boring product for Zope 3
Philipp von Weitershausen
philipp at weitershausen.de
Fri May 21 02:38:08 EDT 2004
Hi Morten,
thanks for this "boring product".
> I'd like to announce the first boring product for Zope 3, a
> simple product meant to illustrate how 'packages' can be
> developed in Zope 3:
>
> http://www.nidelven-it.no/products/zope3_boring/
>
> Comments and feedback are as always appreciated :)
I have a few comments indeed:
1. We are trying to discourage the term "product" the way it was used in
Zope2. In Zope2, there was a clear understanding of what a "product" is
-- something that lives in the Products directory. Zope3 doesn't have
such a directory anymore; Zope3 works with any python packages, whether
they are Zope specific or not. So, maybe you'd like to rename your
"boring product" to "boring package", "boring application", "boring
add-on" or whatever suits you.
2. You seem to be writing a content class that can be added to normal
content space. For content interface, we typically use schema fields to
describe their data, not so much methods, e.g.:
from zope.interface import Interface
from zope.schema import TextLine
class IBoring(Interface):
title = TextLine(
title=u"Title",
description=u"Boring title",
required=True
)
With this, Zope can then automatically render add/edit forms (using the
browser:addform / browser:editform directives) for you. Using this
simplified way of writing content types should probably be more
attractive to beginners than implementing multiple interfaces and methods.
Also, you might want to declare that IBoring is a content type
interface, i.e. that it describes a content type, not some other type of
object. You do that in ZCML with:
<interface
interface=".interfaces.IBoring"
type="zope.app.content.interfaces.IContentType"
/>
3. It would cool if you could adhere to some of the Zope3 coding styles.
We usually write classes in CamelCase, thus I would name the boring
class Boring and the edit view BoringEditView.
4. If you have a 'browser' package, then the 'boring_edit_view' class
(or 'BoringEditView' rather), the boring.png icon and all browser:* ZCML
directives should also move to that package. Otherwise it doesn't make
sense to have it in the first place.
Note that there's an extensive tutorial written by Jim Fulton that
introduces a 'boring' content type (a "Contact"). In 9 steps of the
tutorial, you learn everything from writing an interface to writing
browser views with ZPT for a class. You might want to look at that. I'm
not sure if it's in subversion yet, so I just point you to the CVS resource:
http://cvs.zope.org/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/
Philipp
More information about the Zope3-dev
mailing list