[Checkins] SVN: z3c.pagelet/trunk/src/z3c/pagelet/README.txt fix doc
Christophe Combelles
ccomb at free.fr
Sun Jan 13 11:45:43 EST 2008
Log message for revision 82843:
fix doc
Changed:
U z3c.pagelet/trunk/src/z3c/pagelet/README.txt
-=-
Modified: z3c.pagelet/trunk/src/z3c/pagelet/README.txt
===================================================================
--- z3c.pagelet/trunk/src/z3c/pagelet/README.txt 2008-01-13 16:22:22 UTC (rev 82842)
+++ z3c.pagelet/trunk/src/z3c/pagelet/README.txt 2008-01-13 16:45:42 UTC (rev 82843)
@@ -2,19 +2,21 @@
Pagelets
========
-This package provides a very flexible base implementation for write view like
-components which can be higly customized later in custom project. This is
-needed if you have to write reusable components like needed in a framework.
+This package provides a very flexible base implementation that can be used
+to write view components which can be higly customized later in custom projects.
+This is needed if you have to write reusable components like those needed
+in a framework. Pagelets are BrowserPages made differently and can be used
+to replace them.
What does this mean?
We separate the python view code from the template implementation. And we also
-separate the template in at least two different templates like the content
-template and a layout template.
+separate the template in at least two different templates - the content
+template and the layout template.
-This package uses the z3c.template and offers a implementaton for this
-template patterns. Additionaly this package offers a ``pagelet`` directive
-wich can be used for register pagelets.
+This package uses z3c.template and offers an implementaton for this
+template pattern. Additionaly this package offers a ``pagelet`` directive
+wich can be used to register pagelets.
Pagelets are views which can be called and support the update and render
pattern.
@@ -24,17 +26,17 @@
----------------
A pagelet returns the rendered content without layout in the render method and
-returns the layout code if we call them. See also z3c.template which shows
-how the tempalte work. This samples will only show how the base implementation
+returns the layout code if we call it. See also z3c.template which shows
+how the template works. These samples will only show how the base implementation
located in the z3c.pagelet.browser module get used.
BrowserPagelet
--------------
-The base implementation called BrowserPagelet offers built in __call__ and
-render methods which provide the different template lookup. Take a look at the
-BrowserPagelet class located in z3c.pagelet.browser and you can see that render
+The base implementation called BrowserPagelet offers builtin __call__ and
+render methods which provide the different template lookups. Take a look at the
+BrowserPagelet class located in z3c.pagelet.browser and you can see that the render
method returns a IContentTemplate and the __call__ method a ILayoutTemplate
defined in the z3c.layout package.
@@ -47,7 +49,7 @@
>>> from z3c.pagelet import interfaces
>>> from z3c.pagelet import browser
-We start with define a page template rendering the pagelet content.
+We start by defining a page template rendering the pagelet content.
>>> contentTemplate = os.path.join(temp_dir, 'contentTemplate.pt')
>>> open(contentTemplate, 'w').write('''
@@ -70,10 +72,10 @@
... </html>
... ''')
-Let's now register the template for the view and request. We use the
+Let's now register the template for the view and the request. We use the
TemplateFactory directly from the z3c.template package. This is commonly done
-using the ZCML directive called ``z3c:pagelet``. Note that we do use a the
-generic Interface as the view base interface for register the pagelet. This
+using the ZCML directive called ``z3c:template``. Note that we do use the
+generic Interface as the view base interface to register the template. This
allows us to register a more specific template in the next sample:
>>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
@@ -84,14 +86,14 @@
... factory, (zope.interface.Interface, IDefaultBrowserLayer),
... IContentTemplate)
-And register the layout template useing the ``Interface`` as registration base:
+And register the layout template using the ``Interface`` as registration base:
>>> from z3c.template.interfaces import ILayoutTemplate
>>> factory = TemplateFactory(layoutTemplate, 'text/html')
>>> zope.component.provideAdapter(factory,
... (zope.interface.Interface, IDefaultBrowserLayer), ILayoutTemplate)
-Now define a view marker interface. Such a marker interface is used for let
+Now define a view marker interface. Such a marker interface is used to let
us register our templates:
>>> class IMyView(zope.interface.Interface):
@@ -103,7 +105,7 @@
>>> class MyView(browser.BrowserPagelet):
... zope.interface.implements(IMyView)
-Now test the view providing the view and check the output:
+Now test the view class providing the view and check the output:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
@@ -132,7 +134,7 @@
There is also a standard pattern for calling the render method on pagelet.
Using the pagelet renderer which is a IContentProvider makes it possible to
-reuse existing layout template without the pagelet. If you like to reuse a
+reuse existing layout template without the pagelet. If you want to reuse a
layout template without a pagelet you simply have to provide another content
provider. It's flexible isn't it? As next let's show a sample using the
pagelet renderer.
@@ -165,7 +167,7 @@
ContentProviderLookupError: pagelet
That's right, we need to register the content provider ``pagelet`` before we
-can use them.
+can use it.
>>> from zope.contentprovider.interfaces import IContentProvider
>>> from z3c.pagelet import provider
@@ -189,12 +191,13 @@
Add, Edit and Display forms (formlib)
-------------------------------------
-What whould the pagelet be without formlib based implementations? We offer base
-implementations for add, edit and display forms based on the formlib.
+What would the pagelet be without any formlib based implementations?
+We offer base implementations for add, edit and display forms
+based on the formlib.
-For the next tests we provide a generic form template like used in formlib.
-This template is registered within this package as default for the formlib
-based mixin classes:
+For the next tests we provide a generic form template
+like those used in formlib. This template is registered within this package
+as a default for the formlib based mixin classes:
>>> from z3c import pagelet
>>> baseDir = os.path.split(pagelet.__file__)[0]
@@ -204,7 +207,7 @@
... factory,
... (interfaces.IPageletForm, IDefaultBrowserLayer), IContentTemplate)
-And we define a new interface includig text attribute:
+And we define a new interface including a text attribute:
>>> import zope.schema
>>> class IDocument(zope.interface.Interface):
@@ -221,7 +224,7 @@
PageletAddForm
~~~~~~~~~~~~~~
-Now let's define a add from base on the PageletAddForm class:
+Now let's define an add from based on the PageletAddForm class:
>>> from zope.formlib import form
>>> class MyAddForm(browser.PageletAddForm):
@@ -271,7 +274,7 @@
PageletEditForm
~~~~~~~~~~~~~~~
-Now let's define a edit form based on the PageletEditForm class...
+Now let's define an edit form based on the PageletEditForm class:
>>> class MyEditForm(browser.PageletEditForm):
... form_fields = form.Fields(IDocument)
@@ -316,7 +319,7 @@
PageletDisplayForm
~~~~~~~~~~~~~~~~~~
-Now let's define a display from based on the PageletDisplayForm class...
+Now let's define a display form based on the PageletDisplayForm class...
>>> class MyDisplayForm(browser.PageletDisplayForm):
... form_fields = form.Fields(IDocument)
More information about the Checkins
mailing list