[Zope-CVS] CVS: ZopeProducts/HelloPackage - HelloModule.py:1.1 IHelloModule.py:1.1 README.txt:1.1 __init__.py:1.1 configure.zcml:1.1 hello.pt:1.1

Martijn Faassen m.faassen@vet.uu.nl
Wed, 4 Dec 2002 10:20:58 -0500


Update of /cvs-repository/ZopeProducts/HelloPackage
In directory cvs.zope.org:/tmp/cvs-serv21414

Added Files:
	HelloModule.py IHelloModule.py README.txt __init__.py 
	configure.zcml hello.pt 
Log Message:
Added a very simple 'Hello World' Zope 3 object.


=== Added File ZopeProducts/HelloPackage/HelloModule.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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.
# 
##############################################################################
"""
$Id: HelloModule.py,v 1.1 2002/12/04 15:20:58 faassen Exp $
"""
from IHelloModule import IHello
from Persistence import Persistent
    
class HelloClass(Persistent):
    __implements__ = IHello
    
    def getHello(self):
        return "Hello world"


=== Added File ZopeProducts/HelloPackage/IHelloModule.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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.
# 
##############################################################################
"""
$Id: IHelloModule.py,v 1.1 2002/12/04 15:20:58 faassen Exp $
"""

from Interface import Interface

class IHello(Interface):
    """Hello
    """
    def getHello():
        """Return hello"""


=== Added File ZopeProducts/HelloPackage/README.txt ===
A Zope 3 "Hello World" example. We create a content object that has
a method called 'getHello' that will return Hello world. We make
a very basic view for this content object. Finally we make the object
addable.

'configure.zcml' contains a lot of comments.



=== Added File ZopeProducts/HelloPackage/__init__.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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.
# 
##############################################################################
"""

$Id: __init__.py,v 1.1 2002/12/04 15:20:58 faassen Exp $
"""


=== Added File ZopeProducts/HelloPackage/configure.zcml ===
<!--
zopeConfigure is the root element of the ZCML file.

Besides enclosing the rest of the directive, you define some
namespaces on it in the standard XML namespaces way.

xmlns="uri" defines the default namespace elements are in (when they don't
use the 'foo:bar' notation).

xmlns:foo="uri" defines another namespace. You can put elements in that
namespace by using the defined prefix ('foo:bar').
-->
<zopeConfigure
   xmlns="http://namespaces.zope.org/zope"
   xmlns:browser="http://namespaces.zope.org/browser">

<!--
Declaration of a content object.

This is defined by HelloClass in HelloModule.
-->
<content class=".HelloModule.HelloClass">
  
   <!-- 
   More information about making new Hello objects.
   
   id is used later to refer to it in the add menu. Permission is
   used to restrict who is allowed to add Hello objects.    
   -->
   <factory
      id="Hello"
      permission="Zope.ManageContent"
      title="Hello world"
      description="A simple hello world object." />
 
  <!--
  Permissions on using Hello objects.

  We specify which permission is needed to use attributes. We can have
  more of these, and attributes can be a list as well ('foo bar baz')
  -->
  <require
      permission="Zope.View"
      attributes="getHello" />
</content>

<!-- 
Create a hello.html view for Hello object.

The view has a name (hello.html), it applies to an interface
(IHelloModule.IHello). The view is made from a page template called
hello.pt. Only people with the 'Zope.View' permission may use this
view.
-->
<browser:view
    name="hello.html"
    for=".IHelloModule.IHello"
    template="hello.pt"
    permission="Zope.View" />

<!--
'hello.html' is the default view for the Hello object.
-->
<browser:defaultView 
    name="hello.html" 
    for=".IHelloModule.IHello" />

<!--
Add the Hello object to the add menu.

The add menu is called 'add_content'. It's always a special kind of 
view on the Zope.App.OFS.Container.IAdding interface. 

'action' refers to the id of the content object to add.

'title' is what will show up in the add menu as the name of the
object. 'description' will show up as a description in the add menu as
well.
-->
<browser:menuItem
    menu="add_content"
    for="Zope.App.OFS.Container.IAdding."
    action="Hello"
    title="Hello world" 
    description="An object for hello worlding." />

</zopeConfigure>


=== Added File ZopeProducts/HelloPackage/hello.pt ===
<html>
<body>
<p tal:content="context/getHello">Replace this</p>
</body>
</html>