[Zope3-dev] Re: Boring product for Zope 3
Morten W. Petersen
morten at nidelven-it.no
Fri May 21 10:48:35 EDT 2004
Philipp von Weitershausen wrote:
> Hi Morten,
>
> thanks for this "boring product".
You're welcome. Good thing it didn't bore you too much. :)
>> 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.
OK.
> 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.
Yeah, Stephan Ricther mentioned this on IRC, I'll be using schemas
and tests in the next version of boring.
> 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"
> />
OK.
> 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.
OK.
> 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.
Would anything else than what you've listed have
to be changed to make this work?
> 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/
>
Yup, Chris McDonough told me about this one.
-Morten
More information about the Zope3-dev
mailing list