[Zope3-checkins] SVN: Zope3/trunk/ Added demo package for
zope.app.pagelet
Roger Ineichen
roger at projekt01.ch
Mon Nov 8 08:48:51 EST 2004
Log message for revision 28394:
Added demo package for zope.app.pagelet
Changed:
A Zope3/trunk/package-includes/pageletdemo-configure.zcml
A Zope3/trunk/src/zope/app/demo/pagelet/
A Zope3/trunk/src/zope/app/demo/pagelet/README.txt
A Zope3/trunk/src/zope/app/demo/pagelet/__init__.py
A Zope3/trunk/src/zope/app/demo/pagelet/app.py
A Zope3/trunk/src/zope/app/demo/pagelet/browser/
A Zope3/trunk/src/zope/app/demo/pagelet/browser/__init__.py
A Zope3/trunk/src/zope/app/demo/pagelet/browser/configure.zcml
A Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagedata_pagelet.pt
A Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet.pt
A Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet_box_macros.pt
A Zope3/trunk/src/zope/app/demo/pagelet/browser/index.pt
A Zope3/trunk/src/zope/app/demo/pagelet/browser/pageletmacros.py
A Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py
A Zope3/trunk/src/zope/app/demo/pagelet/configure.zcml
A Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
A Zope3/trunk/src/zope/app/demo/pagelet/interfaces.py
A Zope3/trunk/src/zope/app/demo/pagelet/pageletdemo-configure.zcml
-=-
Added: Zope3/trunk/package-includes/pageletdemo-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/pageletdemo-configure.zcml 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/package-includes/pageletdemo-configure.zcml 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1 @@
+<include package="zope.app.demo.pagelet" />
Property changes on: Zope3/trunk/package-includes/pageletdemo-configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/README.txt 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/README.txt 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,6 @@
+============
+Pagelet Demo
+============
+
+This package demonstrates how to use the pagelet directive. It provides a
+sample content type with different registred pagelets.
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/__init__.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/__init__.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Pagelet Demo
+
+$Id:$
+"""
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/app.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/app.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/app.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Pagelet Demo
+
+$Id:$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+
+from zope.interface import implements
+
+from zope.app.container.contained import Contained
+
+from zope.app.demo.pagelet.interfaces import IPageletContent
+
+
+
+class PageletContent(Persistent, Contained):
+ """A sample content type just for to test pagelet."""
+
+ implements(IPageletContent)
+
+ __parent__ = __name__ = None
+
+ _title = u''
+ _description = u''
+
+ def getTitle(self):
+ """Get the title of the object."""
+ return self._title
+
+ def setTitle(self, title):
+ """Set the title of the object."""
+ self._title = title
+
+ title = property(getTitle, setTitle)
+
+ def getDescription(self):
+ """Get the description of the object."""
+ return self._description
+
+ def setDescription(self, description):
+ """Set the description of the object."""
+ self._description = description
+
+ description = property(getDescription, setDescription)
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/app.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/__init__.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/__init__.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Pagelet Demo
+
+$Id:$
+"""
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/configure.zcml 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/configure.zcml 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,103 @@
+<configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser"
+ i18n_domain="zope"
+ >
+
+ <!-- Pagelet demo content -->
+ <addMenuItem
+ class="..app.PageletContent"
+ title="Demo Pagelet Content"
+ description="Add a Demo Pagelet Content"
+ permission="zope.ManageContent"
+ view="zope.app.demo.pagelet.PageletContent"
+ />
+
+ <addform
+ name="zope.app.demo.pagelet.PageletContent"
+ label="Add a Demo Pagelet Content"
+ schema="..interfaces.IPageletContent"
+ content_factory="..app.PageletContent"
+ permission="zope.ManageContent"
+ />
+
+ <page
+ name="index.html"
+ menu="zmi_views" title="Index"
+ for="..interfaces.IPageletContent"
+ template="index.pt"
+ class=".views.PageletContentView"
+ permission="zope.View"
+ />
+
+ <editform
+ name="edit.html"
+ label="Edit"
+ for="..interfaces.IPageletContent"
+ schema="..interfaces.IPageletContent"
+ menu="zmi_views" title="Edit"
+ permission="zope.ManageContent"
+ />
+
+ <!-- demo pagelet -->
+ <zope:interface interface="..interfaces.IDemoSlot" />
+
+ <!-- pagelet_macros view used for calling additional layout macros
+ used in pagelets
+ -->
+ <page
+ for="*"
+ name="demo_pagelet_macros"
+ permission="zope.View"
+ class=".pageletmacros.DemoPageletMacros"
+ allowed_interface="zope.interface.common.mapping.IItemMapping"
+ />
+
+ <page
+ for="*"
+ name="demo_pagelet_box_macros"
+ permission="zope.View"
+ template="demo_pagelet_box_macros.pt"
+ />
+
+ <!-- pagelets -->
+ <pagelet
+ name="demo_pagelet_macro"
+ layer="zope.publisher.interfaces.browser.IBrowserRequest"
+ slot="..interfaces.IDemoSlot"
+ template="demo_pagelet.pt"
+ for="..interfaces.IPageletContent"
+ permission="zope.View"
+ weight="0"
+ />
+
+ <pagelet
+ name="demo_pagelet_macro2"
+ layer="zope.publisher.interfaces.browser.IBrowserRequest"
+ slot="..interfaces.IDemoSlot"
+ template="demo_pagelet.pt"
+ for="..interfaces.IPageletContent"
+ permission="zope.View"
+ weight="1"
+ />
+
+ <pagelet
+ name="demo_pagedata_pagelet_macro"
+ layer="zope.publisher.interfaces.browser.IBrowserRequest"
+ slot="..interfaces.IDemoSlot"
+ template="demo_pagedata_pagelet.pt"
+ for="..interfaces.IPageletContent"
+ permission="zope.ManageContent"
+ weight="2"
+ />
+
+ <!-- pagedata adapter -->
+ <zope:adapter
+ for="zope.interface.Interface
+ zope.publisher.interfaces.browser.IBrowserRequest
+ zope.component.interfaces.IView"
+ factory=".views.DemoPageData"
+ provides="..interfaces.IDemoPageData"
+ />
+
+</configure>
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagedata_pagelet.pt
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagedata_pagelet.pt 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagedata_pagelet.pt 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,18 @@
+<html metal:use-macro="views/@@demo_pagelet_macros/demo_pagelet_box">
+<body>
+
+<div metal:fill-slot="default">
+
+ <div class="row" metal:define-macro="demo_pagedata_pagelet_macro">
+ <tal:block tal:define="data pagedata:zope.app.demo.pagelet.interfaces.IDemoPageData">
+ <h4>Pagelet: demo_pagedata_pagelet.pt</h4>
+ <h5>Macro: demo_pagedata_pagelet_macro</h5>
+ <h6>Content: title</h6>
+ <span tal:content="data/title">title</span>
+ </tal:block>
+ </div>
+
+</div>
+
+</body>
+</html>
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagedata_pagelet.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet.pt
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet.pt 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet.pt 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,23 @@
+<html metal:use-macro="views/@@demo_pagelet_macros/demo_pagelet_box">
+<body>
+
+<div metal:fill-slot="default">
+
+ <div class="row" metal:define-macro="demo_pagelet_macro">
+ <h4>Pagelet: demo_pagelet.pt</h4>
+ <h5>Macro: demo_pagelet_macro</h5>
+ <h6>Content: title</h6>
+ <div tal:content="view/title">title</div>
+ </div>
+
+ <div class="row" metal:define-macro="demo_pagelet_macro2">
+ <h4>Pagelet: demo_pagelet.pt</h4>
+ <h5>Macro: demo_pagelet_macro2</h5>
+ <h6>Content: (global demoVar from index.pt)</h6>
+ <span tal:content="demoVar">demoVar</span>
+ </div>
+
+</div>
+
+</body>
+</html>
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet_box_macros.pt
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet_box_macros.pt 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet_box_macros.pt 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,11 @@
+<html>
+<body>
+
+<metal:block define-macro="demo_pagelet_box">
+ <metal:block define-slot="default">
+ This text will be replace by the content of a pagelet.
+ </metal:block>
+</metal:block>
+
+</body>
+</html>
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/demo_pagelet_box_macros.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/index.pt
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/index.pt 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/index.pt 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,35 @@
+<html metal:use-macro="context/@@standard_macros/view">
+<body>
+<div metal:fill-slot="body">
+
+ <h1 i18n:translate="">PageletContent View</h1>
+
+ <div class="row">
+ <div class="label">
+ <label>Title</label>
+ </div>
+ <div class="field">
+ <span tal:content="view/title">title</span>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="label">
+ <label>Description</label>
+ </div>
+ <div class="field">
+ <span tal:content="view/description">description</span>
+ </div>
+ </div>
+
+ <tal:block define="global demoVar string:global demo variable" />
+
+ <div class="row">
+ <metal:block tal:repeat="pagelets pagelets:zope.app.demo.pagelet.interfaces.IDemoSlot">
+ <tal:block metal:use-macro="pagelets" />
+ </metal:block>
+ </div>
+
+</div>
+
+</body></html>
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/index.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/pageletmacros.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/pageletmacros.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/pageletmacros.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,23 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Pagelet Demo
+
+$Id:$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.app.basicskin.standardmacros import StandardMacros as BaseMacros
+
+class DemoPageletMacros(BaseMacros):
+ macro_pages = ('demo_pagelet_box_macros',)
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/pageletmacros.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,65 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Pagelet Demo
+
+$Id:$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+
+import zope.interface
+
+from zope.interface import implements
+
+from zope.app.publisher.browser import BrowserView
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+
+from zope.app.pagelet.interfaces import IPageData
+from zope.app.demo.pagelet.interfaces import IPageletContent
+
+
+
+class DemoPageData(object):
+ """Provide an page data class where we use in pagelet."""
+
+ implements(IPageData)
+
+ def __init__(self, context, request, view):
+ self.context = context
+ self.request = request
+ self.view = view
+
+ def title(self):
+ return "DemoPageData title"
+
+ def description(self):
+ return "A hardcoded title from the DemoPageData"
+
+
+
+class PageletContentView(BrowserView):
+ """Provide an index view for PageletContent."""
+
+ __used_for__ = IPageletContent
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def title(self):
+ return self.context.title
+
+ def description(self):
+ return self.context.description
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/configure.zcml 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/configure.zcml 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,26 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:global_translation="http://namespaces.zope.org/gts"
+ i18n_domain="zope"
+ >
+
+ <!-- Sample pagelet content type -->
+ <content class=".app.PageletContent">
+
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+ />
+
+ <require permission="zope.View"
+ interface=".interfaces.IPageletContent"
+ />
+
+ <require permission="zope.ManageContent"
+ set_schema=".interfaces.IPageletContent"
+ />
+
+ </content>
+
+ <include package=".browser" />
+
+</configure>
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/ftests.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/ftests.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,66 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Functional tests for testing pagelet content.
+
+$Id:$
+"""
+
+import unittest
+from zope.app.tests.functional import BrowserTestCase
+from zope.publisher.interfaces import NotFound
+
+
+class TestPageletContent(BrowserTestCase):
+
+ def testPagelet(self):
+ # add the PageletContent
+ response = self.publish(
+ '/+/action.html',
+ basic='mgr:mgrpw',
+ form={'type_name': u'zope.app.demo.pagelet.PageletContent',
+ 'id': u'pagelet'})
+ self.assertEqual(response.getStatus(), 302)
+ self.assertEqual(response.getHeader('Location'),
+ 'http://localhost/+/zope.app.demo.pagelet.PageletContent=pagelet')
+
+ # check add form
+ response = self.publish(
+ '/+/zope.app.demo.pagelet.PageletContent',
+ basic='mgr:mgrpw',
+ form={'UPDATE_SUBMIT' : 'Add',
+ 'add_input_name': u'pagelet',
+ 'field.title': 'aTitle'})
+ self.assertEqual(response.getStatus(), 302)
+ self.assertEqual(response.getHeader('Location'),
+ 'http://localhost/@@contents.html')
+
+ # check the content of the pagelet
+ response = self.publish('/pagelet/@@index.html')
+ self.assertEqual(response.getStatus(), 200)
+ body = ' '.join(response.getBody().split())
+ self.assert_(body.find('<div>aTitle</div>') >= 0)
+ self.assert_(body.find('<span>global demo variable</span>') >= 0)
+ self.assert_(body.find('<h4>Pagelet: demo_pagelet.pt</h4>') >= 0)
+ self.assert_(body.find('<h4>Pagelet: demo_pagedata_pagelet.pt</h4>')
+ >= 0)
+ self.assert_(body.find('<span>DemoPageData title</span>') >= 0)
+
+
+def test_suite():
+ return unittest.TestSuite((
+ unittest.makeSuite(TestPageletContent),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/interfaces.py 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/interfaces.py 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1,57 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Pagelet Demo
+
+$Id:$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.interface import Interface
+
+from zope.schema import Text
+from zope.schema import TextLine
+from zope.schema import Choice
+
+from zope.i18n import MessageIDFactory
+_ = MessageIDFactory('zope')
+
+from zope.app.pagelet.interfaces import IPageletSlot
+from zope.app.pagelet.interfaces import IPageData
+
+
+
+class IPageletContent(Interface):
+ """A sample content type for to test pagelet."""
+
+ title = TextLine(
+ title=_(u"Title"),
+ description=_(u"Title of the sample"),
+ default=u"",
+ required=False)
+
+ description = Text(
+ title=_(u"Description"),
+ description=_(u"Description of the sample"),
+ default=u"",
+ required=False)
+
+
+
+class IDemoSlot(IPageletSlot):
+ """Demo pagelet slot interface for to lookup pagelets."""
+
+
+
+class IDemoPageData(IPageData):
+ """Demo page data adapter interface."""
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/interfaces.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/trunk/src/zope/app/demo/pagelet/pageletdemo-configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/pageletdemo-configure.zcml 2004-11-08 13:47:33 UTC (rev 28393)
+++ Zope3/trunk/src/zope/app/demo/pagelet/pageletdemo-configure.zcml 2004-11-08 13:48:51 UTC (rev 28394)
@@ -0,0 +1 @@
+<include package="zope.app.demo.pagelet" />
Property changes on: Zope3/trunk/src/zope/app/demo/pagelet/pageletdemo-configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Zope3-Checkins
mailing list