[z3-checkins] r24966 - in z3/zopeweb/trunk: . content/documentation
baijum at codespeak.net
baijum at codespeak.net
Fri Mar 24 15:08:39 CET 2006
Author: baijum
Date: Fri Mar 24 15:07:59 2006
New Revision: 24966
Added:
z3/zopeweb/trunk/content/documentation/install.txt
Modified:
z3/zopeweb/trunk/content/documentation/z3tut1.txt
z3/zopeweb/trunk/index.txt
Log:
tutorial part1 and installation notes (not completed).
Added: z3/zopeweb/trunk/content/documentation/install.txt
==============================================================================
--- (empty file)
+++ z3/zopeweb/trunk/content/documentation/install.txt Fri Mar 24 15:07:59 2006
@@ -0,0 +1,63 @@
+===================
+Zope 3 Installation
+===================
+
+The only dependency for Zope 3 istallation is Python 2.4.
+Zope 3 can be installed in all major platforms from source,
+also binary packages are available.
+
+
+GNU/Linux
+---------
+
+
+From Source
++++++++++++
+
+Download Zope 3.2 from http://dev.zope.org/Products/Zope3
+Make sure you are installed Python 2.4.2 (or later).
+
+To install (as root)::
+
+ # tar zxvf Zope-3.2.0.tgz
+ # cd Zope-3.2.0
+ # ./configure --with-python=/path/to/python2.4
+ # make install
+
+Replace ``/path/to/python2.4`` with path to your Python interpreter.
+If you installed python using ``./configure;make;make install``
+most probably your path will be ``/usr/local/bin/python2.4`` .
+
+Binaries
+++++++++
+
+FIXME: include major binary packges, Debian,RPMs,*BSD packages.
+
+Debian Etch or Ubuntu 6.04
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In debian current testing (Etch) and ubuntu latest release::
+
+ # apt-get install zope3
+
+
+Windows
+-------
+
+
+From Source
++++++++++++
+
+FIXME: How to install the latest stable release (3.2) in Windows
+from source.
+
+
+Binaries
+++++++++
+
+First install Python 2.4.2 from `here`_.
+Then download `Zope setup`_
+
+.. _here: http://www.python.org/downloads/Python2.4.2.exe
+.. _Zope setup: http://www.zope.org/Products/Zope3/Zope-3.2.exe
+
Modified: z3/zopeweb/trunk/content/documentation/z3tut1.txt
==============================================================================
--- z3/zopeweb/trunk/content/documentation/z3tut1.txt (original)
+++ z3/zopeweb/trunk/content/documentation/z3tut1.txt Fri Mar 24 15:07:59 2006
@@ -2,57 +2,366 @@
Zope 3 Tutorial (Part 1)
========================
+
Introduction
------------
FIXME: Two or three small paragraphs.
+
Installation
------------
-The latest stable release can be downloaded from
-http://www.zope.org/Products/Zope3 . You will be required to install
-`Python 2.4`_. To install Zope 3 in GNU/Linux::
+You will be required to install `Python 2.4.2`_ or later for
+installing Zope 3. The latest stable release of Zope 3 can be
+downloaded from http://www.zope.org/Products/Zope3 .
+To install Zope 3 in GNU/Linux::
# tar zxvf Zope-3.2.0.tgz
# cd Zope-3.2.0
# ./configure --with-python=/path/to/python2.4
# make install
-For windows use the `setup file`_.
+We recommend binary `setup for windows`_, you may go for source
+installation, if required.
If you cannot install Zope3, see the `detailed instruction`_.
-.. _Python 2.4: http://www.python.org
-.. _setup file: http://www.zope.org/Products/Zope3/3.2.0final/Zope-3.2.0.win32-py2.4.exe
+.. _Python 2.4.2: http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tar.bz2
+.. _setup for windows: http://www.zope.org/Products/Zope3/3.2.0final/Zope-3.2.0.win32-py2.4.exe
.. _detailed instruction: install.html
Make an instance
----------------
+Zope 3 uses ``instances`` to contain the information relevant to a
+server (or set of servers). To create an instance go to installation
+directory and run ``mkzopeinstance`` command, it will ask for few
+values. It will look like something like this::
+
+ $ cd /usr/local/Zope-3.2.0/bin/
+ $ ./mkzopeinstance
+ Please choose a directory in which you'd like to install Zope
+ 'instance home' files such as database files, configuration files,
+ etc.
+
+ Directory: /home/admin/myzope
+
+ Please choose a username for the initial administrator account.
+ This is required to allow Zope's management interface to be used.
+
+ Username: admin
+
+ Please select a password manager which will be used for encode the password of
+ the initial administrator account.
+
+ 1. Plain Text
+ 2. MD5
+ 3. SHA1
+
+ Password Manager Number [1]: 2
+ 'MD5' password manager selected
+
+ Please provide a password for the initial administrator account.
+
+ Password:
+ Verify password:
+
+After creating the instance go to ``instance home``, then run zope::
+
+ $ cd /home/admin/myzope
+ $ ./bin/runzope
+
+You should see something like this::
+
+ ------
+ 2006-03-13T08:20:12 INFO root -- HTTP:localhost:8080 Server started.
+ Hostname: localhost
+ Port: 8080
+ ------
+ 2006-03-13T08:20:12 INFO root Startup time: 9.746 sec real, 5.660 sec CPU
+
+If you get a port error, check whether 8080 is already used by other
+programs; for the time being, just stop it.
+
+
+The instance home
+-----------------
+
+Let's look into your instance home, first read the README.txt.
+This instance home can be considered something like your workplace.
+
+::
+
+ $ ls * -F
+ README.txt
+
+ bin:
+ debugzope* i18nmergeall* importchecker* runzope* test.bat*
+ debugzope.bat* i18nmergeall.bat* importchecker.bat* runzope.bat* zopectl*
+ i18nextract* i18nstats* pyskel* static-apidoc* zopeservice.py*
+ i18nextract.bat* i18nstats.bat* pyskel.bat* test* zpasswd*
+
+ etc:
+ ftesting.zcml package-includes/ securitypolicy.zcml ssh_host_rsa_key
+ overrides_ftesting.zcml principals.zcml server.pem zdaemon.conf
+ overrides.zcml securitypolicy-ftesting.zcml site.zcml zope.conf
+
+ lib:
+ python/
+
+ log:
+ access.log README.txt z3.log
+
+ var:
+ Data.fs Data.fs.index Data.fs.lock Data.fs.tmp README.txt
+
+.. sidebar:: Instance utility scripts
+
+ As you can see, the ``bin`` directory contains few scripts like
+ ``runzope``, ``test`` etc.
+
+ You can controll zope from ``zopectl``, you will get a prompt
+ from where you can start,stop,restart zope.
+
+ Some scripts are only specific to Windows.
+
+
+The `bin` directory contains few scripts like `runzope`, `test`
+etc. Zope saving all data in `var` directory. Backup this directory
+regularly. If ``Data.fs`` is missing, it will be automatically created
+when you run zope again. In `etc` you can see some configuration
+files. In ``etc/zope.conf`` you can edit port numbers of various
+servers. In ``lib/python`` you can place your Zope3 packages. By
+default this won't be in your Python path. You can also place your
+package in any standard Python path.
+
The ZMI
-------
-Instance utility scripts
-------------------------
+If you open a web browser and go to http://localhost:8080 you'll see
+the ZMI (Zope Management Interface).
+
+Go ahead and click the `Login` link at the upper right. Enter the user
+name and password you gave when creating the instance. Now click on
+[top] under `Navigation` on the right. Play around with adding some
+content objects (the Zope 3 name for instances that are visible in the
+ZMI). Note how content objects can be arranged in a hierarchy by
+adding "folders" which are special content objects that can hold other
+content objects.
+
+There is nothing special about the ZMI, it is just the default skin
+for Zope 3. You can modify it to your liking, or replace it entirely.
+
+When you're done exploring with the ZMI, go back to the window where
+you typed "runzope" and see that each request from your browser was
+displayed there as it happened. Press Control-C to stop Zope.
+
+
+Ticket Collector application
+----------------------------
+
+.. sidebar:: Extreme Programming
+
+ We will be using Extreme Programming style terminologies
+ through this tutorial. We recommend you to use this
+ (or similar) development process in your workplace. Zope 3 has taken
+ lots of ideas from `Extreme Programming`_.
+
+To learn Zope 3 application development we will be using a
+issue/bug/ticket collector/tracker/manager application.
+
+First I will tell you the user stories, but we won't be
+doing the complete stories here.
+
+ 1. Individual small ticket collector for each project.
+ Many collectors can be added to one running zope.
+ 2. Any number of tickets can be added to one collector.
+ 3. Each ticket will be added with a description and
+ one initial comment.
+ 4. Additional comments can be added to tickets.
+
+.. _Extreme Programming: http://en.wikipedia.org/wiki/Extreme_programming
-Message board application
--------------------------
Interfaces
----------
+The first thing you have to do in coding to finalize the initial
+intraces of content objects, of course you can evolve it later.
+This is something similar to table design, if you are using
+RDBMS, but not exactly the same, you will understand why it's not.
+
+As I said earlier you acn place your packages in ``lib/python``
+directory. So create ``lib/python/collector``, and don't forget
+to add ``__init__.py`` (empty file) to make it a Python package.
+
+To write our interfaces, create `interfaces.py` file.
+This is our `interfaces.py` ::
+
+ from zope.interface import Interface
+ from zope.schema import Text, TextLine, Field
+
+ from zope.app.container.constraints import ContainerTypesConstraint
+ from zope.app.container.constraints import ItemTypePrecondition
+ from zope.app.container.interfaces import IContained, IContainer
+
+ class IComment(Interface):
+ """Comment for Ticket"""
+
+ body = Text(
+ title=u"Additional Comment",
+ description=u"Body of the Comment.",
+ default=u"",
+ required=True)
+
+ class ITicket(IContainer):
+ """A ticket object."""
+
+ summary = TextLine(
+ title=u"Summary",
+ description=u"Short summary",
+ default=u"",
+ required=True)
+
+ description = Text(
+ title=u"Description",
+ description=u"Full description",
+ default=u"",
+ required=False)
+
+ def __setitem__(name, object):
+ """Add an IComment object."""
+
+ __setitem__.precondition = ItemTypePrecondition(IComment)
+
+
+ class ICollector(IContainer):
+ """The collector the base object. It can only
+ contain ITicket objects."""
+
+ def __setitem__(name, object):
+ """Add an ICollector object."""
+
+ __setitem__.precondition = ItemTypePrecondition(ITicket)
+
+ description = Text(
+ title=u"Description",
+ description=u"A description of the collector.",
+ default=u"",
+ required=False)
+
+
+ class ITicketContained(IContained):
+ """Interface that specifies the type of objects that can contain
+ tickets."""
+
+ __parent__ = Field(
+ constraint = ContainerTypesConstraint(ICollector))
+
+
+ class ICommentContained(IContained):
+ """Interface that specifies the type of objects that can contain
+ comments."""
+
+ __parent__ = Field(
+ constraint = ContainerTypesConstraint(ITicket))
+
+As you can see the first three are our main interfaces, and the rest two
+are actaully constraint interfaces.
+
+
Unit testing
------------
+For most of the unit/functional testing, we will be using doctests.
+But for testing containers we are make using some already written
+unit tests. All unit tests will written in ``tests`` sub-directory.
+
+This is ``tests/test_collector.py``::
+
+ import unittest
+ from zope.testing.doctestunit import DocTestSuite
+
+ from zope.app.container.tests.test_icontainer import TestSampleContainer
+
+ from collector.ticketcollector import Collector
+
+
+ class Test(TestSampleContainer):
+
+ def makeTestObject(self):
+ return Collector()
+
+ def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('collector.ticketcollector'),
+ unittest.makeSuite(Test),
+ ))
+
+ if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
+
+Create a ``tests/test_ticket.py`` file similarly.
+This is very similarly to the above file. ::
+
+ import unittest
+ from zope.testing.doctestunit import DocTestSuite
+
+ from zope.app.container.tests.test_icontainer import TestSampleContainer
+
+ from collector.ticket import Ticket
+
+
+ class Test(TestSampleContainer):
+
+ def makeTestObject(self):
+ return Ticket()
+
+ def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('collector.ticket'),
+ unittest.makeSuite(Test),
+ ))
+
+ if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
+
+And now ``test/test_comment.py`` file::
+
+ import unittest
+ from zope.testing.doctestunit import DocTestSuite
+
+ def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('collector.comment'),
+ ))
+
+ if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
+
+Comment is not a container, but to run our doctests which
+we are going to write should run automatically, so this hook.
+In fact we can write tests in stand alone text files.
+
+To run the unit test::
+
+ $ cd $HOME/myzope/etc
+ $ ../bin/test -vpu --dir boom
+
+Of cource now all tests should fail.
+
+
Implementation
--------------
+
Configuration
-------------
+
Running application
-------------------
Modified: z3/zopeweb/trunk/index.txt
==============================================================================
--- z3/zopeweb/trunk/index.txt (original)
+++ z3/zopeweb/trunk/index.txt Fri Mar 24 15:07:59 2006
@@ -24,6 +24,11 @@
* **Folder: Content/Download**
* **Folder: Content/Documentation**
+
+ * `Zope 3 Tutorial (Part 1) <content/documentation/z3tut1.html>`_
+ * `Zope 3 Tutorial (Part 2) <content/documentation/z3tut2.html>`_
+ * `Zope 3 Tutorial (Part 3) <content/documentation/z3tut3.html>`_
+
* **Folder: Content/News**
* **Folder: Content/Zone**
More information about the z3-checkins
mailing list