[Zope3-dev] First draft, not complete ContentType interfaces
Stephan Richter
stephan.richter@tufts.edu
Tue, 4 Feb 2003 10:25:53 -0500
--Boundary-00=_Bu9P+ED7NO2ofe3
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
There is a discussion right now about ContentTypes, so I wanted to drop in
these interfaces, which we will need for Moztop....
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
--Boundary-00=_Bu9P+ED7NO2ofe3
Content-Type: text/x-python;
charset="us-ascii";
name="TypesRegistry.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="TypesRegistry.py"
"""Interface definitions for an advanced Content Type registry. Note that
these interfaces were particular written for the Moztop IDE and are supposed
to be implemented using Javascript.
However, I think that the Zope 3 core could profit from a similar
infrastructure, however the features would slightly differ.
"""
from zope.interface import Interface
from zope.interface.Attribute import Attribute
class IContentTypeRegistry(Interface):
"""Note that this is a read-only interface.
The registry manages content types by their id and version. The version is
very important, since Moztop should be able to handle sites running
various versions of Zope 3.
"""
def getContentType(id, version):
"""Get the Content Type by its id and a version. If the content type
is part of the official Zope distribution, the version will be the
version of Zope, i.e. 3.1.1."""
class IContentType(Interface):
"""A Content Type object knows about the various tasks it has to perform.
Note that it should only deal with presentation and not functionality.
"""
id = Attribute("Id of the content type.")
version = Attribute("Version of content type.")
title = Attribute("Title of content type which can help describing the
object.")
zope_interface = Attribute("Name of the Zope Interface that this content
object represents.")
def getViewNames():
"""Get the names of all views."""
def getView(name):
"""Get a particular view by name."""
def updateViews():
"""Update the local versions of all views for this content type."""
class IView(Interface):
"""A particular view where the user can do something. Examples include
Contents, Meta Data, Security and Preview.
I think at some point we might have special interfaces for some views so
we can save duplicate efforts.
Also, note that since we only save the path to the view, we can reuse some
of them, such as Meta Data.
"""
name = Attribute("The name of the View.")
path = Attribute("The local path of the file that represents the view,
which is XUL in for Mozilla.")
--Boundary-00=_Bu9P+ED7NO2ofe3--