Author: jmorliaguet
Date: Sun Oct 30 21:35:02 2005
New Revision: 28834

Modified:
   z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/hello.py
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example3/items.py
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example4/actions.py
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/README.txt
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/counter.py
Log:

- API update



Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt       (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt       Sun Oct 30 21:35:02 2005
@@ -1,6 +1,7 @@
 
 .. header:: cpsskins developer tutorial
 
+===========================
 CPSSKINS DEVELOPER TUTORIAL
 ===========================
 
@@ -198,7 +199,7 @@
 
 This example explains how to write a portlet that generates any HTML markup.
 
-The HTML portlet returns the value of the 'html' field.
+The Text portlet returns the value of its 'text' field.
 
 * See the example: `<example2/README.html>`_
 

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt      Sun Oct 30 
21:35:02 2005
@@ -1,11 +1,12 @@
 
 .. header:: cpsskins developer tutorial
 
+========================
 Example 1: Hello portlet
 ========================
 
 :Author: Jean-Marc Orliaguet
-:Version: $Revision: 4 $
+:Version: $Revision: 5 $
 :Copyright: 2005 Nuxeo and Contributors.
 
 .. contents::
@@ -75,20 +76,38 @@
 Now that you have an interface definition for your portlet you need to create
 a class that implements the interface.
 
-Make your portlet a persistent object.
+Make your portlet a persistent and contained object.
 
     >>> from persistent import Persistent
+    >>> from zope.app.container.contained import Contained
 
 Set the 'title' attribute in the portlet's constructor:
 
-    >>> class HelloPortlet(Persistent):
+    >>> class HelloPortlet(Persistent, Contained):
     ...     implements(IHelloPortlet)
     ...
     ...     def __init__(self, title=''):
     ...         self.title = title
 
+You may also simply make your portlet subclass cpsskins.Portlet
+
+    >>> import cpsskins
+
+    >>> class HelloPortlet(cpsskins.Portlet):
+    ...     implements(IHelloPortlet)
+    ...
+    ...     def __init__(self, title=''):
+    ...         self.title = title
+
+
+The Portlet class is defined as::
+
+    class Portlet(Persistent, Contained):
+        """Base class for portlets."""
+
+        identifier = None
 
-Reserved attributes are:
+Reserved attributes (that must not be overriden) are:
 
 - 'identifier' (the portlet's identifier)
 

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/hello.py
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/hello.py        (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/hello.py        Sun Oct 30 
21:35:02 2005
@@ -17,15 +17,15 @@
 """
 __docformat__ = "reStructuredText"
 
-from persistent import Persistent
 from zope.interface import implements
 
+from cpsskins import Portlet
 from cpsskins.interfaces import IPortlet
 
 class IHelloPortlet(IPortlet):
     """Interface for the 'hello world' portlet"""
 
-class HelloPortlet(Persistent):
+class HelloPortlet(Portlet):
     """The Hello portlet always says 'Hello world'.
 
     It is not configurable.

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt      Sun Oct 30 
21:35:02 2005
@@ -1,11 +1,12 @@
 
 .. header:: cpsskins developer tutorial
 
+=======================
 Example 2: Text portlet
-========================
+=======================
 
 :Author: Jean-Marc Orliaguet
-:Version: $Revision: 2 $
+:Version: $Revision: 3 $
 :Copyright: 2005 Nuxeo and Contributors.
 
 Prerequisites
@@ -71,6 +72,10 @@
 However CPSSkins uses the information declared in the interface definition
 to create a visual representation of the fields.
 
+.. figure:: field-hint.png
+
+   the title and the description view in the edit form
+
 Here are the most common field options:
 
 title
@@ -86,9 +91,6 @@
 [?] sign next to the field title, the user will see a hint window pop up
 containing the description (here: "Please enter some text.").
 
-.. figure:: field-hint.png
-
-   the title and the description view in the edit form
 
 required
 ~~~~~~~~
@@ -126,7 +128,9 @@
 
 Here is the final portlet factory::
 
-    >>> class TextPortlet(Persistent):
+    >>> from cpsskins import Portlet
+
+    >>> class TextPortlet(Portlet):
     ...     """The Text portlet displays some text entered by the user.
     ...     """
     ...     implements(ITextPortlet)

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py Sun Oct 30 21:35:02 2005
@@ -21,6 +21,7 @@
 from zope.interface import implements
 from zope.schema import Text
 
+from cpsskins import Portlet
 from cpsskins.interfaces import IPortlet
 
 class ITextPortlet(IPortlet):
@@ -31,7 +32,7 @@
         description=u"Please enter some text. You may also use HTML",
         required=False)
 
-class TextPortlet(Persistent):
+class TextPortlet(Portlet):
     """The Text portlet displays some text entered by the user.
     """
     implements(ITextPortlet)

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example3/items.py
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example3/items.py        (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example3/items.py        Sun Oct 30 
21:35:02 2005
@@ -20,6 +20,7 @@
 from persistent import Persistent
 from zope.interface import implements
 
+from cpsskins import Portlet
 from cpsskins.interfaces import IPortlet
 from cpsskins.model import Items, Item
 
@@ -27,7 +28,7 @@
     """Interface for the Items portlet.
     """
 
-class ItemsPortlet(Persistent):
+class ItemsPortlet(Portlet):
     """The Items portlet returns a list of items.
     """
     implements(IItemsPortlet)

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example4/actions.py
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example4/actions.py      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example4/actions.py      Sun Oct 30 
21:35:02 2005
@@ -23,6 +23,7 @@
 from zope.interface import implements
 from zope.schema import TextLine
 
+from cpsskins import Portlet
 from cpsskins.interfaces import IPortlet
 from cpsskins.model import Items, Item
 
@@ -34,7 +35,7 @@
         title=u"Category",
         )
 
-class ActionsPortlet(Persistent):
+class ActionsPortlet(Portlet):
     """The actions portlet returns a list of items.
     """
     implements(IActionsPortlet)

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/README.txt      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/README.txt      Sun Oct 30 
21:35:02 2005
@@ -1,6 +1,7 @@
 
 .. header:: cpsskins developer tutorial
 
+==========================
 Example 6: Counter portlet
 ==========================
 

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/counter.py
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/counter.py      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example6/counter.py      Sun Oct 30 
21:35:02 2005
@@ -21,6 +21,7 @@
 from zope.component import adapts
 from zope.interface import implements
 
+from cpsskins import Portlet
 from cpsskins.interfaces import IPortlet
 from cpsskins.browser.rendering.interfaces import IUpdateData
 
@@ -29,7 +30,7 @@
 class ICounterPortlet(IPortlet):
     """Interface for the Counter portlet"""
 
-class CounterPortlet(Persistent):
+class CounterPortlet(Portlet):
     """The Counter portlet increments a counter before being displayed.
     """
     implements(ICounterPortlet)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to