Author: tziade
Date: Thu Mar 16 10:18:04 2006
New Revision: 2646

Added:
   cookbook/trunk/recipe58.en.tex
   cookbook/trunk/recipe58.fr.tex
Modified:
   cookbook/trunk/cookbook.en.kilepr
   cookbook/trunk/cookbook.fr.kilepr
   cookbook/trunk/mapping.txt
   cookbook/trunk/recipe49.fr.tex
   cookbook/trunk/recipe57.en.tex
   cookbook/trunk/recipe_list.txt
Log:
tgv commit, added recipe 58 and started recipe 57

Modified: cookbook/trunk/cookbook.en.kilepr
==============================================================================
--- cookbook/trunk/cookbook.en.kilepr   (original)
+++ cookbook/trunk/cookbook.en.kilepr   Thu Mar 16 10:18:04 2006
@@ -1,7 +1,7 @@
 [General]
 img_extIsRegExp=false
 img_extensions=.eps .pdf .dvi .ps .fig .gif .jpg .jpeg .png
-lastDocument=
+lastDocument=file:///home/svn.z3lab.org/cookbook/recipe57.en.tex
 masterDocument=
 name=Zope 3 Cookbook, English
 pkg_extIsRegExp=false
@@ -16,7 +16,7 @@
 [item:cookbook.en.kilepr]
 archive=true
 column=0
-encoding=UTF-8
+encoding=ISO 8859-15
 highlight=None
 line=0
 open=false
@@ -68,3 +68,19 @@
 highlight=LaTeX
 line=0
 open=true
+
+[item:recipe57.en.tex]
+archive=true
+column=0
+encoding=ISO 8859-15
+highlight=LaTeX
+line=52
+open=true
+
+[item:recipe58.en.tex]
+archive=true
+column=0
+encoding=ISO 8859-15
+highlight=LaTeX
+line=20
+open=true

Modified: cookbook/trunk/cookbook.fr.kilepr
==============================================================================
--- cookbook/trunk/cookbook.fr.kilepr   (original)
+++ cookbook/trunk/cookbook.fr.kilepr   Thu Mar 16 10:18:04 2006
@@ -23,26 +23,26 @@
 
 [item:recipe00.fr.tex]
 archive=true
-column=11
+column=43
 encoding=ISO 8859-15
 highlight=LaTeX
-line=0
+line=70
 open=true
 
 [item:recipe07.fr.tex]
 archive=true
-column=27
+column=62
 encoding=ISO 8859-15
 highlight=LaTeX
-line=107
+line=237
 open=true
 
 [item:recipe48.fr.tex]
 archive=true
-column=28
+column=44
 encoding=ISO 8859-15
 highlight=LaTeX
-line=106
+line=116
 open=true
 
 [item:recipe49.fr.tex]
@@ -50,21 +50,37 @@
 column=0
 encoding=ISO 8859-15
 highlight=LaTeX
-line=0
+line=11
 open=true
 
 [item:recipe50.fr.tex]
 archive=true
-column=39
+column=14
 encoding=ISO 8859-15
 highlight=LaTeX
-line=153
+line=172
 open=true
 
 [item:recipe51.fr.tex]
 archive=true
-column=14
+column=34
+encoding=ISO 8859-15
+highlight=LaTeX
+line=70
+open=true
+
+[item:recipe57.fr.tex]
+archive=true
+column=0
+encoding=ISO 8859-15
+highlight=LaTeX
+line=5
+open=true
+
+[item:recipe58.fr.tex]
+archive=true
+column=20
 encoding=ISO 8859-15
 highlight=LaTeX
-line=4
+line=0
 open=true

Modified: cookbook/trunk/mapping.txt
==============================================================================
--- cookbook/trunk/mapping.txt  (original)
+++ cookbook/trunk/mapping.txt  Thu Mar 16 10:18:04 2006
@@ -6,4 +6,8 @@
     - 50
     - 51
     - 52
-    - 56
\ No newline at end of file
+    - 56
+
+- 57
+
+    - 58
\ No newline at end of file

Modified: cookbook/trunk/recipe49.fr.tex
==============================================================================
--- cookbook/trunk/recipe49.fr.tex      (original)
+++ cookbook/trunk/recipe49.fr.tex      Thu Mar 16 10:18:04 2006
@@ -9,7 +9,7 @@
 \chapter*{Interagir avec Zope dans les tests}
 
 \begin{problem}
-TODO
+Que ce soit pour les tests fonctionnels ou les tests unitaires,
 \end{problem}
 
 \begin{solution}

Modified: cookbook/trunk/recipe57.en.tex
==============================================================================
--- cookbook/trunk/recipe57.en.tex      (original)
+++ cookbook/trunk/recipe57.en.tex      Thu Mar 16 10:18:04 2006
@@ -9,27 +9,81 @@
 \chapter*{Organizing the code in a package}
 
 \begin{problem}
-Packages are composed of Python files and ZCML ones. It may also contains
+A packages is composed of Python files and ZCML ones. It may also contains
 page templates and resources, like images, css or javascript files.
 
 This recipe explains how to organize all these elements, for the package
-to be easily maintained.
+to be easily maintainable.
 \end{problem}
 
 \begin{solution}
 
 \section*{Understanding what is a package}
 
+The strict Python definition of a package is: a folder containing a set of
+modules and subfolders composing a namespace, added in the Python path.
+The folder and the subfolders of the package have to contain an
+\code{\_\_init\_\_.py} file in order to be recognized by the interpreter.
+
+In Zope, the package has an extended meaning: it's the smallest pluggable
+part of the server. This was called \textit{Product} under Zope 2. Since the
+initialization mechanism is based on the ZCML files, Zope acts the same way
+as Python, but looks for a \code{configure.zcml} in the root folder.
+
+From there, any kind of code organization would work, as long as the modules
+are linked in the ZCML file. But a bit of structuration is needed, based on a
+few conventions.
+
 \section*{Setting up the minimum structure}
 
-\subsection*{Choosing between module-based or file-based}
+The smallest package is composed of a \code{\_\_init\_\_.py} empty file, and a
+\code{configure.zcml} file containing at least an empty \code{configure}
+directive.
+
+\codetitle{The smallest configure.zcml:}
+\begin{verbatim}
+<configure\>
+\end{verbatim}
+
+These two files are gathered in a folder, which is declared in a configuration
+file in the {INSTANCE/etc/package-includes} folder. The configuration file
+has to be named with a \textit{-configure.zcml} suffix, and conventionally uses
+the package folder name for the prefix. So a package called \textit{dummy}
+will have a \textit{dummy-configure.zcml} file, declaring it.
+
+\codetitle{The dummy-configure.zcml file:}
+\begin{verbatim}
+<include package="dummy"/>
+\end{verbatim}
+
+At startup, Zope will include the first \code{dummy} folder it finds in the
+path.
+
+\section*{Setting up a real-world structure}
+
+The \code{dummy} package will now implement an exciting and original feature:
+an \code{hello.html} browser view that displays "Hello, world" on the browser.
+
+***The first nedeed element is a \code{IHelloWorld}�interface************
+interfaces***
+browser*****
+
+
+\subsection*{Choosing between module-based or folder-based}
+
+***talk about the choice browser.py <-> browser folder etc...
 
 \section*{Adding tests}
 
+***talk about tests folder, tests.py, ftests.py, text files for
+doctests etc..
+
 \section*{Adding specific elements}
 
+***talk about meta.zcml, resources, etc..
+
 \section*{Splitting up a growing package}
+***talk about pure python package , stuff like that
 
 \end{solution}
-
 \end{document}

Added: cookbook/trunk/recipe58.en.tex
==============================================================================
--- (empty file)
+++ cookbook/trunk/recipe58.en.tex      Thu Mar 16 10:18:04 2006
@@ -0,0 +1,62 @@
+\documentclass{book}
+\pagestyle{headings}
+\include{macros}
+\status{draft}
+\author{Tarek Ziad�}
+
+\begin{document}
+
+\chapter*{Learning naming conventions}
+
+\begin{problem}
+This recipe presents Zope 3 naming conventions, and a small set of good
+practices on choosing good names.
+\end{problem}
+
+\begin{solution}
+
+TO BE FINISHED
+
+\section*{Using the right names for files and folders}
+
+In the past, Zope 2 was using \code{CapitalizedWords} for its Products folders,
+its module names, and of course its class names. This convention led to messy
+import statements since most Python standard and third party libraries uses
+small caps. It was also hard to guess which part of the import is a file,
+and which one is a class name.
+
+\codetitle{A typical import bloc in Zope 2 CMF:}
+\begin{verbatim}
+import base64
+import marshal
+import re
+from warnings import warn
+from AccessControl import ClassSecurityInfo
+from AccessControl import getSecurityManager
+from Acquisition import aq_parent, aq_inner, aq_base
+from Globals import DTMLFile
+from Globals import InitializeClass
+from OFS.OrderSupport import OrderSupport
+from OFS.Folder import Folder
+\end{verbatim}
+
+Zope 3 therefore uses small caps for all package and filename, for much
+clearer import blocs.
+
+\codetitle{A typical import bloc in Zope 3:}
+\begin{verbatim}
+import zope.interface
+from zope import component
+from zope.schema.interfaces import ISourceQueriables
+from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
+from zope.app.location.interfaces import ILocation
+from zope.app.component import queryNextUtility
+from zope.app.component.site import SiteManagementFolder
+from zope.app.authentication import interfaces
+\end{verbatim}
+
+*****TO BE FINISHED
+
+\end{solution}
+
+\end{document}

Added: cookbook/trunk/recipe58.fr.tex
==============================================================================
--- (empty file)
+++ cookbook/trunk/recipe58.fr.tex      Thu Mar 16 10:18:04 2006
@@ -0,0 +1,19 @@
+\documentclass{book}
+\pagestyle{headings}
+\include{macros}
+\status{draft}
+\author{Tarek Ziad�}
+
+\begin{document}
+
+\chapter*{Apprendre les conventions de nommage}
+
+\begin{problem}
+Pas encore traduit de l'anglais.
+\end{problem}
+
+\begin{solution}
+Pas encore traduit de l'anglais.
+\end{solution}
+
+\end{document}

Modified: cookbook/trunk/recipe_list.txt
==============================================================================
--- cookbook/trunk/recipe_list.txt      (original)
+++ cookbook/trunk/recipe_list.txt      Thu Mar 16 10:18:04 2006
@@ -72,6 +72,7 @@
 55 - using a sql database to store data
 56 - testing forms with zope.testbrowser
 57 - organizing the code in a package
+58 - learning naming conventions
 - ...
 
 Developping Zope - advanced recipes
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to