[Checkins] SVN: plone.z3cform/trunk/ Turn this README.txt into a doctest, and have it catch up with the API

Daniel Nouri daniel.nouri at gmail.com
Thu Jul 24 05:51:55 EDT 2008


Log message for revision 88777:
  Turn this README.txt into a doctest, and have it catch up with the API
  changes.
  

Changed:
  U   plone.z3cform/trunk/README.txt
  A   plone.z3cform/trunk/plone/z3cform/README.txt
  U   plone.z3cform/trunk/plone/z3cform/tests.py
  U   plone.z3cform/trunk/setup.py

-=-
Modified: plone.z3cform/trunk/README.txt
===================================================================
--- plone.z3cform/trunk/README.txt	2008-07-24 09:01:39 UTC (rev 88776)
+++ plone.z3cform/trunk/README.txt	2008-07-24 09:51:53 UTC (rev 88777)
@@ -2,44 +2,9 @@
 plone.z3cform
 =============
 
-plone.z3cform is a library that allows use of z3c.form with Zope 2 and
-Plone.
+plone.z3cform is a library that allows use of `z3c.form`_ with Zope 2
+and the CMF_.
 
-Quick start
-===========
+.. _z3c.form: http://pypi.python.org/pypi/z3c.form
+.. _CMF: http://www.zope.org/Products/CMF
 
-Tons of examples of using ``z3c.form`` can be found online.  This is a
-simple example of a form for Plone:
-
-  >>> from zope import interface, schema
-  >>> from z3c.form import form, field, button
-  >>> from plone.z3cform import base
-
-  >>> class MySchema(interface.Interface):
-  ...     age = schema.Int(title=u"Age")
-
-  >>> class MyForm(form.Form):
-  ...     fields = field.Fields(MySchema)
-  ...     ignoreContext = True # don't try to get data from context
-  ...
-  ...     @button.buttonAndHandler(u'Apply')
-  ...     def handleApply(self, action):
-  ...         data, errors = self.extractData()
-  ...         print data['age'] # ... or do stuff
-
-  >>> class MyView(base.FormWrapper):
-  ...     form = MyForm
-  ...     label = u"Please enter your age"
-
-Note that we're using ``base.FormWrapper`` as a base class for our
-browser view.  We can register the ``MyView`` view just like any other
-``browser:page``.
-
-Only the ``MyView`` bit is specific to ``plone.z3cform``. The rest is
-standard ``z3c.form`` stuff. For more details on the base FormWrapper
-class, see the ``plone.z3cform.base`` module.
-
-Please also refer to the `online documentation`_ for more details.
-
-.. _online documentation: http://plone.org/documentation/how-to/easy-forms-with-plone3
-

Added: plone.z3cform/trunk/plone/z3cform/README.txt
===================================================================
--- plone.z3cform/trunk/plone/z3cform/README.txt	                        (rev 0)
+++ plone.z3cform/trunk/plone/z3cform/README.txt	2008-07-24 09:51:53 UTC (rev 88777)
@@ -0,0 +1,33 @@
+Quick start
+===========
+
+A quick example:
+
+  >>> from zope import interface, schema
+  >>> from z3c.form import form, field, button
+  >>> from plone.z3cform.layout import wrap_form
+
+  >>> class MySchema(interface.Interface):
+  ...     age = schema.Int(title=u"Age")
+
+  >>> class MyForm(form.Form):
+  ...     fields = field.Fields(MySchema)
+  ...     ignoreContext = True # don't use context to get widget data
+  ...     label = u"Please enter your age"
+  ... 
+  ...     @button.buttonAndHandler(u'Apply')
+  ...     def handleApply(self, action):
+  ...         data, errors = self.extractData()
+  ...         print data['age'] # ... or do stuff
+
+  >>> MyView = wrap_form(MyForm)
+
+The ``wrap_form`` function returns a browser view that embeds your
+form in a layout template.  Register ``MyView`` as a ``browser:page``.
+
+For more examples, please refer to the `z3c.form docs`_ and to `this
+how-to`_.
+
+
+.. _z3c.form docs: http://docs.carduner.net/z3c.form
+.. _this how-to: http://plone.org/documentation/how-to/easy-forms-with-plone3


Property changes on: plone.z3cform/trunk/plone/z3cform/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: plone.z3cform/trunk/plone/z3cform/tests.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/tests.py	2008-07-24 09:01:39 UTC (rev 88776)
+++ plone.z3cform/trunk/plone/z3cform/tests.py	2008-07-24 09:51:53 UTC (rev 88777)
@@ -65,6 +65,11 @@
         layout_txt, fieldsets_txt,
 
         doctest.DocFileSuite(
+           'README.txt',
+           setUp=testing.setUp, tearDown=testing.tearDown,
+           ),
+
+        doctest.DocFileSuite(
            'crud/README.txt',
            setUp=testing.setUp, tearDown=testing.tearDown,
            ),

Modified: plone.z3cform/trunk/setup.py
===================================================================
--- plone.z3cform/trunk/setup.py	2008-07-24 09:01:39 UTC (rev 88776)
+++ plone.z3cform/trunk/setup.py	2008-07-24 09:51:53 UTC (rev 88777)
@@ -7,6 +7,7 @@
 def description():
     join = lambda *paths: os.path.join('plone', 'z3cform', *paths)
     return (open('README.txt').read() + '\n' +
+            open(join('README.txt')).read() + '\n' +
             open(join('crud', 'README.txt')).read() + '\n' +
             open(join('fieldsets', 'README.txt')).read() + '\n' +
             open(os.path.join('docs', 'HISTORY.txt')).read() + '\n')



More information about the Checkins mailing list