[Zope3-checkins] CVS: Products3/demo/messageboard/step1 - __init__.py:1.1 configure.zcml:1.1 interfaces.py:1.1 message.py:1.1 messageboard.py:1.1

Stephan Richter srichter@cbu.edu
Sat, 7 Jun 2003 07:24:50 -0400


Update of /cvs-repository/Products3/demo/messageboard/step1
In directory cvs.zope.org:/tmp/cvs-serv11446/messageboard/step1

Added Files:
	__init__.py configure.zcml interfaces.py message.py 
	messageboard.py 
Log Message:
Initial checkin of the Zope 3 Cookbook example code. Currently only step1
is completed and step2 is merely a copy right now. This product will be 
updated as I am developing the recipes.

Note: Please do not make modifications to the code, unless you are willing
      to spend the time modifying the recipes as well. At some point I will
      add a final step, which can become the playground for developers and 
      will not mirror any recipe.


=== Added File Products3/demo/messageboard/step1/__init__.py ===


=== Added File Products3/demo/messageboard/step1/configure.zcml ===
<zopeConfigure
   xmlns="http://namespaces.zope.org/zope">

  <content class=".messageboard.MessageBoard">

    <implements
       interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />

    <factory
        id="MessageBoard"
        permission="zope.ManageContent"
        description="Message Board" />

    <require
        permission="zope.ManageContent"
        interface=".interfaces.IMessageBoard"/>

    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IMessageBoard"/>

  </content>

  <content class=".message.Message">

    <implements
       interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />

    <factory
        id="Message"
        permission="zope.ManageContent"
        description="Message" />

    <require
        permission="zope.ManageContent"
        interface=".interfaces.IMessage"/>

    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IMessage"/>

  </content>

  <include package=".browser" />

</zopeConfigure>


=== Added File Products3/demo/messageboard/step1/interfaces.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Message Board Interfaces

Interfaces for the Zope 3 based Message Board Product 

$Id: interfaces.py,v 1.1 2003/06/07 11:24:48 srichter Exp $
"""

from zope.app.interfaces.container import IContainer
from zope.schema import Text, TextLine

class IMessageBoard(IContainer):
    """The message board is the base object for our product. It can only
    contain IMessage objects."""

    description = Text(
        title=u"Description",
        description=u"A detailed description of the content of the board.",
        default=u"",
        required=False)


class IMessage(IContainer):
    """A message object. It can contain its own responses."""

    title = TextLine(
        title=u"Title/Subject",
        description=u"Title and/or subject of the message.",
        default=u"",
        required=True)

    body = Text(
        title=u"Message Body",
        description=u"This is the actual message. Type whatever you wish.",
        default=u"",
        required=False)


=== Added File Products3/demo/messageboard/step1/message.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Message Implementation

An implementation of the Message using Folders as base.

$Id: message.py,v 1.1 2003/06/07 11:24:48 srichter Exp $
"""
from zope.interface import implements
from zope.app.container.btree import BTreeContainer
from zopeproducts.messageboard.interfaces import IMessage

class Message(BTreeContainer):
    __doc__ = IMessage.__doc__

    implements(IMessage)
    _title = u''
    _body = u''

    def getTitle(self):
        """Get the title of the board."""
        return self._title

    def setTitle(self, title):
        """Set the title of the board."""
        self._title = title

    # See zopeproducts.messageboard.interfaces.IMessage
    title = property(getTitle, setTitle)

    def getBody(self):
        """Get the body of the board."""
        return self._body

    def setBody(self, body):
        """Set the body of the board."""
        self._body = body
        
    # See zopeproducts.messageboard.interfaces.IMessage
    body = property(getBody, setBody)




=== Added File Products3/demo/messageboard/step1/messageboard.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Message Board Implementation

An implementation of the Message Board using Folders as base.

$Id: messageboard.py,v 1.1 2003/06/07 11:24:48 srichter Exp $
"""
from zope.interface import implements
from zope.app.container.btree import BTreeContainer
from zopeproducts.messageboard.interfaces import IMessageBoard

class MessageBoard(BTreeContainer):
    __doc__ = IMessageBoard.__doc__

    implements(IMessageBoard)

    _desc = u''

    def getDescription(self):
        """Get the description of the board."""
        return self._desc

    def setDescription(self, desc):
        """Set the description of the board."""
        self._desc = desc

    # See zopeproducts.messageboard.interfaces.IMessageBoard
    description = property(getDescription, setDescription)