[Checkins] SVN: z3c.demo/trunk/src/z3c/demo/ Reflect changes from z3c.website, use new sample setup pattern

Roger Ineichen roger at projekt01.ch
Wed May 23 07:41:58 EDT 2007


Log message for revision 75905:
  Reflect changes from z3c.website, use new sample setup pattern
  Added initial version of HowTo sample

Changed:
  A   z3c.demo/trunk/src/z3c/demo/SETUP.cfg
  D   z3c.demo/trunk/src/z3c/demo/calculator/SETUP.cfg
  U   z3c.demo/trunk/src/z3c/demo/calculator/browser.py
  U   z3c.demo/trunk/src/z3c/demo/calculator/browser.zcml
  U   z3c.demo/trunk/src/z3c/demo/calculator/calculator.py
  D   z3c.demo/trunk/src/z3c/demo/calculator/z3c.demo.calculator-configure.zcml
  A   z3c.demo/trunk/src/z3c/demo/configure.zcml
  A   z3c.demo/trunk/src/z3c/demo/howto/
  A   z3c.demo/trunk/src/z3c/demo/howto/__init__.py
  A   z3c.demo/trunk/src/z3c/demo/howto/app.py
  A   z3c.demo/trunk/src/z3c/demo/howto/browser.py
  A   z3c.demo/trunk/src/z3c/demo/howto/browser.zcml
  A   z3c.demo/trunk/src/z3c/demo/howto/configure.zcml
  A   z3c.demo/trunk/src/z3c/demo/howto/index.pt
  A   z3c.demo/trunk/src/z3c/demo/howto/interfaces.py
  A   z3c.demo/trunk/src/z3c/demo/i18n.py
  A   z3c.demo/trunk/src/z3c/demo/z3c.demo-configure.zcml

-=-
Added: z3c.demo/trunk/src/z3c/demo/SETUP.cfg
===================================================================
--- z3c.demo/trunk/src/z3c/demo/SETUP.cfg	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/SETUP.cfg	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+  z3c.demo-*.zcml
+</data-files>

Deleted: z3c.demo/trunk/src/z3c/demo/calculator/SETUP.cfg
===================================================================
--- z3c.demo/trunk/src/z3c/demo/calculator/SETUP.cfg	2007-05-23 11:40:29 UTC (rev 75904)
+++ z3c.demo/trunk/src/z3c/demo/calculator/SETUP.cfg	2007-05-23 11:41:58 UTC (rev 75905)
@@ -1,3 +0,0 @@
-<data-files zopeskel/etc/package-includes>
-  z3c.demo.calculator-*.zcml
-</data-files>

Modified: z3c.demo/trunk/src/z3c/demo/calculator/browser.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/calculator/browser.py	2007-05-23 11:40:29 UTC (rev 75904)
+++ z3c.demo/trunk/src/z3c/demo/calculator/browser.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -17,28 +17,13 @@
 __docformat__ = "reStructuredText"
 
 import zope.interface
-import zope.component
-from zope.component.interfaces import IFactory
-from zope.dublincore.interfaces import IZopeDublinCore
-from zope.traversing.browser import absoluteURL
-from zope.traversing import api
-from zope.app.renderer.rest import ReStructuredTextToHTMLRenderer
-from zc.table import column
-from zc.table import table
-
-from z3c.configurator import configurator
-from z3c.pagelet import browser
-from z3c.form import form
-from z3c.form import field
-from z3c.form import widget
-from z3c.template.interfaces import ILayoutTemplate
-
-from z3c.website.i18n import MessageFactory as _
-from z3c.website.browser.page import PageAddForm
+from z3c.website.browser.sample import SampleAddForm
+from z3c.demo.i18n import MessageFactory as _
 from z3c.demo.calculator import calculator
 
 
-class CalculatorAddForm(PageAddForm):
+class CalculatorAddForm(SampleAddForm):
+    """Calculator sample useing the ISamplePagelet."""
 
     label = _('Add Calculator sample')
     factory = calculator.Calculator

Modified: z3c.demo/trunk/src/z3c/demo/calculator/browser.zcml
===================================================================
--- z3c.demo/trunk/src/z3c/demo/calculator/browser.zcml	2007-05-23 11:40:29 UTC (rev 75904)
+++ z3c.demo/trunk/src/z3c/demo/calculator/browser.zcml	2007-05-23 11:41:58 UTC (rev 75905)
@@ -5,8 +5,9 @@
     i18n_domain="z3c.website">
 
   <z3c:pagelet
-      name="addZ3CCalculator.html"
+      name="addZ3Calculator.html"
       for="z3c.website.interfaces.ISamples"
+      provides="z3c.website.interfaces.ISampleAddForm"
       class=".browser.CalculatorAddForm"
       layer="z3c.website.layer.IWebSiteBrowserLayer"
       permission="z3c.website.ManageSite"
@@ -16,8 +17,9 @@
   <!-- register formdemo views -->
   <configure package="z3c.formdemo.calculator">
   <z3c:pagelet
-      name="sample.html"
+      name="index.html"
       for="z3c.demo.calculator.interfaces.ICalculator"
+      provides="z3c.website.interfaces.ISamplePagelet"
       class=".browser.Calculator"
       layer="z3c.website.layer.IWebSiteBrowserLayer"
       permission="zope.Public"

Modified: z3c.demo/trunk/src/z3c/demo/calculator/calculator.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/calculator/calculator.py	2007-05-23 11:40:29 UTC (rev 75904)
+++ z3c.demo/trunk/src/z3c/demo/calculator/calculator.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -16,11 +16,11 @@
 """
 
 import zope.interface
-from z3c.website import page
+from z3c.website import sample
 from z3c.demo.calculator import interfaces
 
 
-class Calculator(page.Page):
+class Calculator(sample.Sample):
     """Calculator sample."""
 
     zope.interface.implements(interfaces.ICalculator)

Deleted: z3c.demo/trunk/src/z3c/demo/calculator/z3c.demo.calculator-configure.zcml
===================================================================
--- z3c.demo/trunk/src/z3c/demo/calculator/z3c.demo.calculator-configure.zcml	2007-05-23 11:40:29 UTC (rev 75904)
+++ z3c.demo/trunk/src/z3c/demo/calculator/z3c.demo.calculator-configure.zcml	2007-05-23 11:41:58 UTC (rev 75905)
@@ -1 +0,0 @@
-<include package="z3c.demo.calculator" />

Added: z3c.demo/trunk/src/z3c/demo/configure.zcml
===================================================================
--- z3c.demo/trunk/src/z3c/demo/configure.zcml	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/configure.zcml	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,8 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="z3c.website">
+
+  <include package=".calculator" />
+  <include package=".howto" />
+
+</configure>

Added: z3c.demo/trunk/src/z3c/demo/howto/__init__.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/__init__.py	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/__init__.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+$Id: __init__.py 69382 2006-08-09 13:26:53Z rogerineichen $
+"""

Added: z3c.demo/trunk/src/z3c/demo/howto/app.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/app.py	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/app.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,33 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+import zope.interface
+from z3c.website import sample
+from z3c.demo.howto import interfaces
+
+
+class HowToSample(sample.Sample):
+    """The HowToSample object must provide the ISample interface.
+    
+    The simples way to do this is, if you use the z3c.website.sample.Sample
+    class as base.
+    
+    You can enhance this object here if you need to or mixin other base classes
+    as well.
+    """
+
+    zope.interface.implements(interfaces.IHowToSample)

Added: z3c.demo/trunk/src/z3c/demo/howto/browser.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/browser.py	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/browser.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+$Id: __init__.py 69382 2006-08-09 13:26:53Z rogerineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+from z3c.pagelet import browser
+from z3c.website.browser.sample import SampleAddForm
+from z3c.website.interfaces import ISamplePagelet
+from z3c.demo.i18n import MessageFactory as _
+from z3c.demo.howto import app
+
+
+class HowToAddForm(SampleAddForm):
+    """Add form for HowTo sample object."""
+
+    label = _(u'Add HowTo sample')
+    factory = app.HowToSample
+
+
+class HowToSample(browser.BrowserPagelet):
+    """Sample page."""

Added: z3c.demo/trunk/src/z3c/demo/howto/browser.zcml
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/browser.zcml	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/browser.zcml	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,33 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    xmlns:z3c="http://namespaces.zope.org/z3c"
+    i18n_domain="z3c.website">
+
+  <!-- this is the sample add form -->
+  <z3c:pagelet
+      name="addZ3HowToSample.html"
+      for="z3c.website.interfaces.ISamples"
+      provides="z3c.website.interfaces.ISampleAddForm"
+      class=".browser.HowToAddForm"
+      layer="z3c.website.layer.IWebSiteBrowserLayer"
+      permission="z3c.website.ManageSite"
+      />
+
+  <!-- this is the sample page -->
+  <z3c:pagelet
+      name="index.html"
+      for="z3c.demo.howto.interfaces.IHowToSample"
+      provides="z3c.website.interfaces.ISamplePagelet"
+      class=".browser.HowToSample"
+      layer="z3c.website.layer.IWebSiteBrowserLayer"
+      permission="zope.Public"
+      />
+
+  <z3c:template
+      template="index.pt"
+      for=".browser.HowToSample"
+      layer="z3c.website.layer.IWebSiteBrowserLayer"
+      />
+
+</configure>

Added: z3c.demo/trunk/src/z3c/demo/howto/configure.zcml
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/configure.zcml	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/configure.zcml	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,18 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="z3c.website">
+
+  <class class=".app.HowToSample">
+    <require
+        permission="zope.Public"
+        interface=".interfaces.IHowToSample"
+        />
+    <require
+        permission="z3c.website.ManageContent"
+        set_schema=".interfaces.IHowToSample"
+        />
+  </class>
+
+  <include file="browser.zcml" />
+
+</configure>

Added: z3c.demo/trunk/src/z3c/demo/howto/index.pt
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/index.pt	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/index.pt	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,3 @@
+<div>
+  This is the text form the How to sample template.
+</div>
\ No newline at end of file

Added: z3c.demo/trunk/src/z3c/demo/howto/interfaces.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/howto/interfaces.py	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/howto/interfaces.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,28 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+import datetime
+import decimal
+import zope.interface
+import zope.schema
+from z3c.website import interfaces
+
+
+class IHowToSample(interfaces.ISample):
+    """The IHowToSample must provide the z3c.website.interfaces.ISample 
+    interface.
+    """

Added: z3c.demo/trunk/src/z3c/demo/i18n.py
===================================================================
--- z3c.demo/trunk/src/z3c/demo/i18n.py	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/i18n.py	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+import zope.i18nmessageid
+
+MessageFactory = zope.i18nmessageid.MessageFactory('z3c.demo')

Added: z3c.demo/trunk/src/z3c/demo/z3c.demo-configure.zcml
===================================================================
--- z3c.demo/trunk/src/z3c/demo/z3c.demo-configure.zcml	                        (rev 0)
+++ z3c.demo/trunk/src/z3c/demo/z3c.demo-configure.zcml	2007-05-23 11:41:58 UTC (rev 75905)
@@ -0,0 +1 @@
+<include package="z3c.demo" />



More information about the Checkins mailing list