Jean-Marc Orliaguet wrote:
...
the idea is that you define as many categories as you need: IMetaType,
ISomeCategory, IWidgetType ... and you create relations between
interfaces with:

    directlyProvides(IFile, IContentType)

Exactly.

as if you had a relation tool,

There are all sorts of ways of expressing relationships in Python
without central databases.

> then every object that implements IFile
(no matter in what position) will have the IFile content type?

Right.  Note that a content type is a specific kind of type.

If an object provides interface I, then the object is said to
be of type I.  If I is a content type, then the object is said
to have that content type.

As a matter of policy, we expect an object to have a single content
type and have a helper function for getting "the content type" by
finding an object's most specifiuc type that is a content type.

But where do you put the 'directlyProvides' statement?

There are two options.  You put it in some python module, such
as the module that defines IFile:

  class IFile(...):
     ...

  directlyProvides(IFile, IContentType)

or, since this is often a configuration choice, you put in in
zcml:


  <interface
      interface=".interfaces.IFile"
      type="zope.app.content.interfaces.IContentType"
      />

Jim

--
Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to