[Zope3-checkins] CVS: Zope3/src/zope/products/demo/hellopackage -
README.txt:1.1 __init__.py:1.1 configure.zcml:1.1
configure_bare.zcml:1.1 hello.pt:1.1 hellomodule.py:1.1
interfaces.py:1.1
Philipp von Weitershausen
philikon at philikon.de
Thu Jan 15 10:01:37 EST 2004
Update of /cvs-repository/Zope3/src/zope/products/demo/hellopackage
In directory cvs.zope.org:/tmp/cvs-serv29969/demo/hellopackage
Added Files:
README.txt __init__.py configure.zcml configure_bare.zcml
hello.pt hellomodule.py interfaces.py
Log Message:
Move the 'hellopackage' example package to the new 'demo' package. This is
the preferred place for example products that should be part of the Zope3
distribution.
=== Added File Zope3/src/zope/products/demo/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.
In this package we are excessively explicit in the naming in an attempt to
make it more clear what's going on, especially in the ZCML. Instead of naming
everything left and right 'Hello', there is now a distinction in the package
name, module name, etc. This is not the normal style of naming in Zope 3
however.
'configure.zcml' contains a lot of comments.
To enable this, go to your 'products.zcml' in the Zope 3 root and
add the line:
<include package="zopeproducts.hellopackage" />
presuming you installed this package in ZopeProducts.
=== Added File Zope3/src/zope/products/demo/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 2004/01/15 15:01:36 philikon Exp $
"""
=== Added File Zope3/src/zope/products/demo/hellopackage/configure.zcml ===
<!-- An extensively commented configure.zcml. If you want to see
the same file without any comments, check out 'configure_bare.zcml
-->
<!--
configure 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').
i18n_domain="hellopackage" defines the internationalization (i18n)
domain for this package
-->
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:global_translation="http://namespaces.zope.org/gts"
i18n_domain="hellopackage"
>
<!--
Declaration of a content object.
This is defined by HelloClass in hellomodule.
-->
<content class=".hellomodule.HelloClass">
<implements
interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
/>
<!--
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 (index.html),it applies to ZMI tab called (View) and it applies to an interface
(interfaces.IHello). The view is made from a page template called
hello.pt. Only people with the 'Zope.View' permission may use this
view.
-->
<browser:page for=".interfaces.IHello"
name="index.html"
menu="zmi_views"
title="View"
template="hello.pt"
permission="zope.View"
/>
<!--
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.interfaces.container.IAdding"
action="Hello"
title="Hello world"
description="An object for hello worlding." />
</configure>
=== Added File Zope3/src/zope/products/demo/hellopackage/configure_bare.zcml ===
<!-- See configure.zcml for this with a lot of comments. This is just
to demo how short it is without comments. -->
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="hellopackage"
>
<content class=".hellomodule.HelloClass">
<factory
id="Hello"
permission="zope.ManageContent"
title="Hello world"
description="A simple hello world object." />
<require
permission="zope.View"
attributes="getHello" />
</content>
<browser:page
name="hello.html"
for=".interfaces.IHello"
template="hello.pt"
permission="zope.View" />
<browser:defaultView
name="hello.html"
for=".interfaces.IHello" />
<browser:menuItem
menu="add_content"
for="zope.app.interfaces.container.IAdding."
action="Hello"
title="Hello world"
description="An object for hello worlding." />
</configure>
=== Added File Zope3/src/zope/products/demo/hellopackage/hello.pt ===
<html metal:use-macro="context/@@standard_macros/page"
i18n:domain="hellopackage">
<head>
<body>
<div metal:fill-slot="body">
<p tal:content="context/getHello">Replace this</p>
</div>
</body>
</html>
=== Added File Zope3/src/zope/products/demo/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 2004/01/15 15:01:36 philikon Exp $
"""
from interfaces import IHello
from persistence import Persistent
from zope.interface import implements
class HelloClass(Persistent):
implements(IHello)
def getHello(self):
return "Hello world"
=== Added File Zope3/src/zope/products/demo/hellopackage/interfaces.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: interfaces.py,v 1.1 2004/01/15 15:01:36 philikon Exp $
"""
from zope.interface import Interface
class IHello(Interface):
"""Hello
"""
def getHello():
"""Return hello"""
More information about the Zope3-Checkins
mailing list