[Z3lab-checkins] r2785 - cookbook
Author: tziade Date: Fri Apr 7 21:46:23 2006 New Revision: 2785 Removed: cookbook/ Log: moved -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2762 - cookbook/trunk
Author: tziade Date: Sun Apr 2 19:25:03 2006 New Revision: 2762 Modified: cookbook/trunk/recipe00.en.tex cookbook/trunk/recipe_list.txt Log: using a formatted text, that will be used by xmlrpc scripts to display project status over the website Modified: cookbook/trunk/recipe00.en.tex == --- cookbook/trunk/recipe00.en.tex (original) +++ cookbook/trunk/recipe00.en.tex Sun Apr 2 19:25:03 2006 @@ -18,14 +18,14 @@ A recipe is made of a problem and a solution section. \begin{itemize} -\item The problem describe in less than 20 lines the problem to solve. +\item The problem describes in less than 20 lines the problem to solve. -\item The solution is made of sections and subsections, and provide the +\item The solution is made of sections and subsections, and provides the solution. \end{itemize} The solution can contain text and code. The code can be made with several -specific commands. +specific commands \section*{Specific commands for the code blocs} Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Sun Apr 2 19:25:03 2006 @@ -1,95 +1,63 @@ -Recipes list - +# number - title - state1 - state2 - ... -Categories -== +# for each language, the state can be: +# lang-0 : nothing done +# lang-1 : beeing written +# lang-2 : written +# lang-3 : being translated + + +01 - zope installation - fr-0 - en-0 +02 - understanding runzope, zopectl, and other things - fr-0 - en-0 +03 - understanding the interface - fr-0 - en-0 +04 - the zope component architecture - fr-0 - en-0 +05 - understanding the development process - fr-0 - en-0 +06 - writing unit tests - fr-0 - en-0 +07 - writing functional tests - fr-2 - en-2 +08 - debugging the code - fr-0 - en-0 +09 - understanding Interfaces - fr-0 - en-0 +10 - understanding the traversal - fr-0 - en-0 +11 - mastering ZCML - fr-0 - en-0 +12 - mastering ZPT - fr-0 - en-0 +13 - adding an extension package - fr-0 - en-0 +14 - creating and publishing an object - fr-0 - en-0 +15 - creating resources - fr-0 - en-0 +16 - creating a global utility - fr-0 - en-0 +17 - creating a local utility - fr-0 - en-0 +18 - understanding Adapters - fr-0 - en-0 +19 - creating an Adapter - fr-0 - en-0 +20 - understanding forms - fr-0 - en-0 +21 - creating a object with forms - fr-0 - en-0 +22 - understanding Events - fr-0 - en-0 +23 - using Events - fr-0 - en-0 +24 - setting up a development environment (xx path) - fr-0 - en-0 + +40 - setting up authentication - fr-0 - en-0 +41 - designing a publication workflow - fr-0 - en-0 +42 - working with metadata (annotations) - fr-0 - en-0 +43 - creating a new skin - fr-0 - en-0 +44 - driving the application with XML-RPC - fr-0 - en-0 +45 - creating an internationalized package - fr-0 - en-0 +46 - creating multilanguage content objects - fr-0 - en-0 +47 - changing and migrating existing objects - fr-0 - en-0 +48 - writing reSTructuredText for documentation and doctests - fr-2 - en-2 +49 - interacting with zope in tests - fr-1 - en-0 +50 - finding the good pace between coding, documenting, unit testing and functional testing - fr-2 - en-2 +51 - recording a user web session to write tests - fr-2 - en-2 +52 - organizing the code in a package - fr-2 - en-2 +53 - using ldap to store users - fr-0 - en-0 +54 - using a sql database to store data - fr-0 - en-0 +55 - testing forms with zope.testbrowser - fr-0 - en-0 +56 - organizing the code in a package - fr-0 - en-0 +57 - learning naming conventions - fr-0 - en-0 +58 - creating a new content object - fr-0 - en-0 +59 - retrieving an object url - fr-2 - en-2 +60 - creating a rss feed for a container - fr-0 - en-0 +61 - writing and reading dublincore metadatas - fr-0 - en-0 + +70 - extending ZCML - fr-0 - en-0 +71 - extending ZPT - fr-0 - en-0 +72 - implementing a new publisher - fr-0 - en-0 -- Using Zope -- Developping Zope - the concepts -- Developping Zope - real-world recipes -- Developping Zope - advanced recipes -- Administrating Zope - -Levels -== - -TODO - - -Recipes -=== - -Using Zope -~~ - -01 - zope installation -02 - understanding runzope, zopectl, and other things -03 - understanding the interface - -Developping Zope - the concepts -~~~ - -04 - the zope component architecture -05 - understanding the development process -06 - writing unit tests -07 - writing functional tests (TZ, fr-en:MR) -08 - debugging the code -09 - understanding Interfaces -10 - understanding the traversal -11 - mastering ZCML -12 - mastering ZPT -13 - adding an extension package -14 - creating and publishing an object -15 - creating resources -16 - creating a global utility -17 - creating a local utility -18 - understanding Adapters -19 - creating an Adapter -20 - understanding forms -21
[Z3lab-checkins] r2756 - cookbook/trunk
Author: tziade Date: Sat Apr 1 22:46:49 2006 New Revision: 2756 Modified: cookbook/trunk/recipe50.en.tex Log: finished translation Modified: cookbook/trunk/recipe50.en.tex == --- cookbook/trunk/recipe50.en.tex (original) +++ cookbook/trunk/recipe50.en.tex Sat Apr 1 22:46:49 2006 @@ -49,30 +49,27 @@ Using this document, she creates the code following these steps: \begin{itemize} -\item Transcripting in a reST document (doctest) the specifications; +\item Translating in a reST document (doctest) the specifications; \item inserting code examples, that fullfills the features asked; \item coding the underlying code, so the examples in the document works for real. \end{itemize} -\subsection*{Transcripting the need into a doctest file} -x +\subsection*{Translating the need into a doctest file} -Transcrire en doctest les besoins exprim�s se fait en synth�tisant au maximum le -cahier des charges, et en d�crivant la structure du paquet qui va �tre -d�velopp�. - -Prenons l'exemple d'un module en charge de r�cup�rer des flux RSS pour les -stocker dans des objets Python persistants, puis les rendre affichables dans -l'application. Le d�veloppeur d�cide d'organiser son paquet en trois modules: +Translating in doctests the needs is done by summarrizing the specifications, +and by describing the future package structure. + +Let's code for example a package that handles the retrieval of RSS feeds to +store them in persistent Python objects, then provide web views. The developer +decides to organize the package in three modules: \begin{itemize} -\item \code{rssfetcher.py}: module en charge de la r�cup�ration des flux RSS; -\item \code{rssobject.py}: module en charge de la cr�ation et du stockage -des donn�es; -\item \code{rssview.py}: module en charge de l'affichage des donn�es. +\item \code{rssfetcher.py}: module for RSS retrieval; +\item \code{rssobject.py}: module for creating and storing data; +\item \code{rssview.py}: module for viewing data. \end{itemize} -\noindent Il commence par �crire quatre fichiers doctests, qui expriment cette +\noindent She starts to write four doctests files, that shows the future code structure: \begin{itemize} \item \code{README.txt} @@ -81,55 +78,51 @@ \item \code{rssview.txt} \end{itemize} -Le fichier \code{README.txt} d�crit en quelques phrases l'objectif du paquet, -et pr�sente sa structure. +The \code{README.txt} file describe in a few sentences the package goal, and +present its structure. -\codetitle{Fichier README.txt} +\codetitle{README.txt file:} \begin{Verbatim} rssreader = -Ce paquet permet de pr�senter des flux rss. Il est organis� en trois -composants: +This package knows how to display RSS feeds. It is organized in three modules. -- rssfetcher: sait lire un flux RSS 1.0 -- rssobject: stocke le flux et fourni des m�thodes d'acc�s -- rssview: sait afficher un flux dans le navigateur +- rssfetcher: knows how to read RSS 1.0 feeds +- rssobject: store the feeds and provides accessors +- rssview: know how to display a feed in the browser \end{Verbatim} -\noindent Chaque module est pr�sent� � son tour dans un doctest. +\noindent Each module then has its own doctest file. -\codetitle{Fichier rssfetcher.txt} +\codetitle{rssfetcher.txt file:} \begin{verbatim} rssfetcher == -Le module rssreader transforme un fichier XML au format RSS 1.0 -vers une structure Python exploitable. Il est invoqu� avec l'URL -d'un flux et renvoi une liste contenant les entr�es du flux. +rssfetcher module transforms a RSS 1.0 XML file into a Python usable structure. +It is called with the feed URL and returns a list with the feed entries. \end{verbatim} -A ce stade, le d�veloppeur n'a pas encore �crit de code, mais -dispose d'une sp�cification technique et architecturelle exploitable. +At this point the developer didn't write any code, but has a first draft of +the package structure and technical specifications. This step reveals sometimes +some incoherences in the needs. -\subsection*{Ins�rer des exemples de codes} +\subsection*{Inserting code examples} -Sur la base de ces fichiers textes, le d�veloppeur peut commencer -� pr�parer le d�veloppement des modules, en explicitant la face -visible de ces derniers, c'est � dire les API qui seront utilis�es -dans d'autres modules. +Using these text files, the developer can start to define each module high level +public elements, that will be used by other modules. -\codetitle{Modification du fichier rssfetcher.txt} +\codetitle{Changing rssfetcher.txt:} \begin{verbatim} rssfetcher == -Le module rssfetcher transforme un fichier XML au format RSS 1.0 -vers une structure Python exploitable. Il est invoqu� avec l'URL -d'un flux et renvoi une liste contenant les entr�es du flux. +rssfetcher module transforms a RSS 1.0 XML file into a Python usable structure
[Z3lab-checkins] r2745 - cookbook/trunk
Author: tziade Date: Thu Mar 30 18:28:32 2006 New Revision: 2745 Added: cookbook/trunk/recipe60.en.tex cookbook/trunk/recipe60.fr.tex Modified: cookbook/trunk/cookbook.en.kilepr cookbook/trunk/cookbook.fr.kilepr cookbook/trunk/recipe_list.txt Log: added recipe 60 (tgv commit) Modified: cookbook/trunk/cookbook.en.kilepr == --- cookbook/trunk/cookbook.en.kilepr (original) +++ cookbook/trunk/cookbook.en.kilepr Thu Mar 30 18:28:32 2006 @@ -1,7 +1,7 @@ [General] img_extIsRegExp=false img_extensions=.eps .pdf .dvi .ps .fig .gif .jpg .jpeg .png -lastDocument=file:///home/svn.z3lab.org/cookbook/recipe50.en.tex +lastDocument=file:///home/svn.z3lab.org/cookbook/recipe60.en.tex masterDocument= name=Zope 3 Cookbook, English pkg_extIsRegExp=false @@ -31,10 +31,10 @@ [item:recipe07.en.tex] archive=true -column=0 +column=4 encoding=ISO 8859-15 highlight=LaTeX -line=6 +line=127 open=true [item:recipe48.en.tex] @@ -82,5 +82,21 @@ column=0 encoding=ISO 8859-15 highlight=LaTeX -line=6 +line=28 +open=true + +[item:recipe60.en.tex] +archive=true +column=33 +encoding=ISO 8859-15 +highlight=LaTeX +line=54 +open=true + +[item:recipe60.en.txt] +archive=true +column=0 +encoding=ISO 8859-15 +highlight=LaTeX +line=0 open=true Modified: cookbook/trunk/cookbook.fr.kilepr == --- cookbook/trunk/cookbook.fr.kilepr (original) +++ cookbook/trunk/cookbook.fr.kilepr Thu Mar 30 18:28:32 2006 @@ -84,3 +84,11 @@ highlight=LaTeX line=0 open=true + +[item:recipe60.fr.tex] +archive=true +column=145167160 +encoding= +highlight= +line=0 +open=false Added: cookbook/trunk/recipe60.en.tex == --- (empty file) +++ cookbook/trunk/recipe60.en.tex Thu Mar 30 18:28:32 2006 @@ -0,0 +1,66 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Retrieving an object URL} + +\begin{problem} +Zope 3 has a different, cleaner approach on how to handle URLs of objects. +A given object doesn't have its proper URL like it use to have in Zope 2. +This recipe presents how to retrieve an URL for a given object, and the logic +behind. +\end{problem} + +\begin{solution} +\section*{Understanding URLs} +Each persistent object stored in the ZODB is reached through views, that +handles its display. The URL is the location from wich the object is reached +through the browser. For example, is the user tries to display \code{foo}, which +is in \code{bar}, she will type: \code{http://server/foo/bar}. The object is +pulled by the publisher which traverses the tree of objects from the root. +In our case, it traverses \code{foo}, ask it for \code{bar}, and so on. +\code{foo} will point \code{bar} to the publisher, because its +\code{\_\_name\_\_} property is \code{bar}. + +Getting an object URL is done by doing the back trip from the object to +the root, building the string with the names of all traversed objects. + +The main difference with older behaviors is that \code{bar} doesn't hold its +URL. + +\section*{Getting an object URL} + +The URL of all publishable objects can be retrieved this way, and a generic +view class, called \code{AbsoluteURL} provide this feature under the +\code{absolute\_url} name. + +In a ZPT for instance, a given object URL can be retrieved with: +\code{my\_object/@@absolute\_url}. In Python code, a call to +\code{zapi.getMultiAdapter()} that knows how to retrieve a given view, can be +used. + +\codetitle{Retrieving an object URL:} +\begin{Verbatim} + from zope.app.testing.functional import BrowserTestCase + from zope.app import zapi + class MyTest(BrowserTestCase): +... def test_url(self): +... root = self.getRootFolder() +... request = self.makeRequest() +... url = zapi.getMultiAdapter((root, request), name='absolute_url')() +... self.assertEquals(url, 'http://localhost') +... + import unittest + suite = unittest.makeSuite(MyTest) + test_runner = unittest.TextTestRunner() + test_runner.run(suite) +unittest._TextTestResult run=1 errors=0 failures=0 +\end{Verbatim} + +\end{solution} + +\end{document} Added: cookbook/trunk/recipe60.fr.tex == --- (empty file) +++ cookbook/trunk/recipe60.fr.tex Thu Mar 30 18:28:32 2006 @@ -0,0 +1,67 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} +\translator{Tarek Ziad�} + +\begin{document} + +\chapter*{R�cup�rer l'URL d'un objet} + +\begin{problem} +Zope 3 propose une approche plus \textit{propre} que la version pr�c�dente en +ce qui concerne les URL des objets. Un objet donn� ne conserve pas +son URL comme attribut. Cette recette explique le m�canisme de calcul +de l'URL d'un objet et la logique
[Z3lab-checkins] r2714 - cookbook/trunk
Author: tziade Date: Fri Mar 24 23:31:18 2006 New Revision: 2714 Modified: cookbook/trunk/recipe48.en.tex Log: finished translation Modified: cookbook/trunk/recipe48.en.tex == --- cookbook/trunk/recipe48.en.tex (original) +++ cookbook/trunk/recipe48.en.tex Fri Mar 24 23:31:18 2006 @@ -10,152 +10,143 @@ \chapter*{Writing reSTructuredText for documentation and doctests} \begin{problem} -translation to finish +The whole Zope documentation available inside its packages is written in +reSTructuredText or reST, which is an evolution of StructuredText. This +structured text is more readable as is than LaTeX, since the tags don't change +the text itself. Tools allow then to convert reST files to +publishable formats like HTML, XML or PDF. -L'ensemble de la documentation des paquets de Zope est r�alis�e au format -reSTructuredText, ou reST, qui est une �volution du StructuredText. Ce format -fourni une structure simple, qui n'alourdit pas le texte, contrairement � -LaTeX, et peut �tre lu directement. Des outils permettent ensuite de manipuler -ce contenu pour le transformer en HTML, LaTeX, XML ou PDF. - -Cette recette est une \textit{cheatsheet} minimale, qui permet d'�crire des -doctests destin�s � des paquets Zope, une documentation plus compl�te pouvant -�tre trouv� � cette URL: +This recipe is a minimal \textit{cheatsheet} to write doctests for Zope +packages using reST. A complete documentation is available here: \url{http://docutils.sourceforge.net/rst.html}. \end{problem} \begin{solution} -\section*{Structurer le fichier} -Pour organiser un fichier en section, sous-section, sous-sous-section, etc., -il suffit de souligner le titre de la section avec un caract�re dans l'ensemble: +\section*{Structuring the file} +To organise a file into sections, subsections and so forth, the section title +just need to be underlined with a character from: \begin{verbatim} = - ` : ' ~ ^ _ * + # \end{verbatim} -A chaque section, si un nouveau caract�re est utilis�, reST l'associe au niveau -donn� pour le reste du document. +Whenever the reST engine meet such underlines, it links the given level to +the character in use, for the rest of the document. -\codetitle{Exemple de structure reST:} +\codetitle{a reST example:} \begin{verbatim} -Titre +Title = -Ok, donc j'ai deux sections. Profitez-en. +Ok, so I have two sections, enjoy ! Section 1 ~ -Le titre est un frimeur. j'en parle dans une sous-section. +The title shows off. I talk about it in a subsection. -Sous-Section 1 --- +Subsection 1 + -Je suis charg� par ma section de casser du sucre sur le dos -de Titre, mais je n'en ferais rien, je vise une promotion. +Section 1 asked me to make fun of Title, but I won't, since +I am trying to get promoted. Section 2 ~ -Calmons nous, le document est fini de toute mani�re... +Let's calm down folks, the document is over... \end{verbatim} -\section*{Ins�rer des exemples de code} +\section*{Inserting code examples} -Ins�rer du code se fait en l'indentant d'au minimum 1 caract�re (en g�n�ral 2 -ou 4). Ce bloc doit �tre pr�c�d� du signe :: et d'une ligne vide, puis -suivi d'une ligne vide. +Inserting a code bloc is done by indenting it with at least one character. +(most of the time people do 2 or 4). The bloc must be preceded by a :: sign +and an empty line, then forwarded by an empty line. -\codetitle{Insertion de code:} +\codetitle{Code insertion:} \begin{verbatim} -Le module Math -== +The Math module +=== -Python dispose d'un module math, qui fourni une fonction pour les puissances:: +Python has a math module that has a function for power:: import math math.pow(56, 3) 175616.0 -Il y a aussi pi:: +It has pi as well:: math.pi 3.1415926535897931 - \end{verbatim} \begin{codenotes} -\item Zope 3 indente de deux caract�res, mais certains d�veloppeurs pr�f�rent -une indentation sur 4 caract�res, peut �tre pour �diter plus facilement -ces fichiers dans leur �diteur de code Python. +\item Zope 3 use a 2 spaces identing, but some developers use 4, like +Python code. \end{codenotes} -\section*{Ins�rer des liens et formater le texte} +\section*{Inserting links and formatting the text} -\noindent reST permet aussi d'afficher du texte en italique, en gras. +\noindent reST provide tags to display bold or italic text. -\codetitle{Gras et italique:} +\codetitle{Bold and italic:} \begin{verbatim} -Recette -=== +Facts += -Il n'y a absolument pas de **gras** dans les plats `italiens`. +They aren't more **bold** people in `Italia` than in other part of the world. \end{verbatim} -\noindent La notation italique est utilis�e pour mettre en exergue un module -ou tout �l�ment de code dans le texte. La notation grasse est r�serv�e � la -mise en valeur de mots du texte. +\noindent Italic is used to emphasis
[Z3lab-checkins] r2715 - cookbook/trunk
Author: tziade Date: Fri Mar 24 23:31:47 2006 New Revision: 2715 Modified: cookbook/trunk/recipe57.en.tex Log: added translator info Modified: cookbook/trunk/recipe57.en.tex == --- cookbook/trunk/recipe57.en.tex (original) +++ cookbook/trunk/recipe57.en.tex Fri Mar 24 23:31:47 2006 @@ -3,6 +3,7 @@ \include{macros} \status{draft} \author{Tarek Ziad�} +\translator{Tarek Ziad�} \begin{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2716 - cookbook/trunk
Author: tziade Date: Fri Mar 24 23:32:08 2006 New Revision: 2716 Modified: cookbook/trunk/recipe58.en.tex Log: added translator info Modified: cookbook/trunk/recipe58.en.tex == --- cookbook/trunk/recipe58.en.tex (original) +++ cookbook/trunk/recipe58.en.tex Fri Mar 24 23:32:08 2006 @@ -3,6 +3,7 @@ \include{macros} \status{draft} \author{Tarek Ziad�} +\translator{Tarek Ziad�} \begin{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2717 - cookbook/trunk
Author: tziade Date: Fri Mar 24 23:32:25 2006 New Revision: 2717 Modified: cookbook/trunk/recipe49.en.tex Log: added translator info Modified: cookbook/trunk/recipe49.en.tex == --- cookbook/trunk/recipe49.en.tex (original) +++ cookbook/trunk/recipe49.en.tex Fri Mar 24 23:32:25 2006 @@ -3,6 +3,7 @@ \include{macros} \status{draft} \author{Tarek Ziad�} +\translator{Tarek Ziad�} \begin{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2718 - cookbook/trunk
Author: tziade Date: Fri Mar 24 23:32:58 2006 New Revision: 2718 Modified: cookbook/trunk/recipe48.fr.tex Log: removed borderline joke Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48.fr.tex (original) +++ cookbook/trunk/recipe48.fr.tex Fri Mar 24 23:32:58 2006 @@ -115,7 +115,7 @@ == Matin et soir : un tour sur `zope-cookbook`_ -Midi: Ne pas oublier le suppositoire. +Midi: Ne pas oublier la pilule. .. _`zope-cookbook`: http://zope-cookbook.org \end{verbatim} @@ -134,12 +134,12 @@ == Matin et soir : un tour sur `zope-cookbook`_ -_`suppositoire`: -Midi: Ne pas oublier le suppositoire. +_`pilule`: +Midi: Ne pas oublier la pilule. _`zope-cookbook`: Zope-cookbook.org est un site tr�s sympa. Mais avant d'y aller, -avez vous pens� � votre `suppositoire`_ ? +avez vous pens� � votre `pilule`_ ? \end{verbatim} \section*{Adopter de bonnes pratiques} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2694 - cookbook/trunk
Author: tziade Date: Thu Mar 23 00:23:58 2006 New Revision: 2694 Modified: cookbook/trunk/textest.py Log: emptying tests that does not match Modified: cookbook/trunk/textest.py == --- cookbook/trunk/textest.py (original) +++ cookbook/trunk/textest.py Thu Mar 23 00:23:58 2006 @@ -32,7 +32,7 @@ def _latexfilter(source): code_blocs = cExtracter.findall(source) if code_blocs == []: -return source +return '' return ''.join(code_blocs).strip() def TexFileTest(path, module_relative=True, package=None, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2695 - cookbook/trunk
Author: tziade Date: Thu Mar 23 01:03:21 2006 New Revision: 2695 Modified: cookbook/trunk/recipe51.en.tex cookbook/trunk/recipe_list.txt Log: translated recipe 51 (fr-en) Modified: cookbook/trunk/recipe51.en.tex == --- cookbook/trunk/recipe51.en.tex (original) +++ cookbook/trunk/recipe51.en.tex Thu Mar 23 01:03:21 2006 @@ -3,17 +3,121 @@ \include{macros} \status{draft} \author{Tarek Ziad�} +\translator{Tarek Ziad�} \begin{document} \chapter*{Recording a user web session to write tests} \begin{problem} -Not translated in english yet. +Writing a functional test is most of the time driven by a precise user story, +where all steps are made with the provided user interface. For Zope, the +interface is most of the time the browser. + +Coding a full user web session can be a real pain. + +This recipe presents how to record browser activities and use it back, in order +to speed up functionnal test writing. \end{problem} \begin{solution} -Not translated in english yet. + +\section*{Knowing about the zope.app.recorder package} + +Zope 3 provides \code{zope.app.recorder}, wich let the developer add a special +publisher, configured through \code{zope.conf}. This publisher acts like a +proxy and record user actions over the browser. The problem is that its output +are a bit raw to use and must be worked out. The extra workload to make it +usable for \code{zope.testbrowser} can be quite long. + +\section*{Using zope.testrecorder} + +Zope Corp has created another package, called \code{zope.testrecorder}, which +provides the same kind of features, but with output in convenient forms: +\begin{itemize} +\item \code{Python Doctest}, usable as is for \code{zope.testbrowser}; +\item \code{Selenium Test}, usable with \code{Selenium} tool. +\end{itemize} + +\subsection*{Installing} + +The tool is not part of Zope 3, and must be downloaded separately. There are +neither website nor packaged distribution yet. The source code has to be taken +from Zope.org's subversion repository, and placed into the \code{/lib/python} +directory of the instance. + +\codetitle{Getting zope.testrecorder from subversion} +\begin{verbatim} [EMAIL PROTECTED]:~$ cd /home/zopes/zope3/lib/python/ [EMAIL PROTECTED]:/home/zopes/zope3/lib/python$ svn co svn://svn.zope.org/repos/main/zope.testrecorder/trunk testrecorder +Atestrecorder/html +Atestrecorder/html/recorder.js +[...] +Atestrecorder/testrecorder.py +R�vision 65919 extraite. +\end{verbatim} + +The package is then hooked to Zope by adding a initialization file, called +\code{testrecorder-configure.zcml}, and placed into the +\code{etc/package-includes} directory of the instance, with the content below. + +\codetitle{testrecorder-configure.zcml file} +\begin{verbatim} +include package=testrecorder / +\end{verbatim} + +When Zope is restarted, a new resource directory called \code{recorder} is made +available, and points over the \code{html} directory of the package. + +\subsection*{Recording a session} + +After the installation is done, \code{testrecorder} is reachable through +\url{/@@/recorder/index.html}. This page presents a banner where the initial +URL to visit can be typed to start a session recording. The page appears +under the banner and the tester can start a session recording by clicking +around. + +The \code{Stop Recording} button finishes the session recording. + +\begin{center} +\includegraphics[bb=0 0 302 270]{media/recipe51.screenshot1.png} +% recipe51.screenshot1.png: 72.009dpi, width=10.65cm, height=9.52cm, bb=0 0 302 270 +\legend{zope.testrecorder at work} +\end{center} + +\subsection*{Getting back results} + +When the session is done, \code{testrecorder} provides two types of outputs. +The \code{Python Doctest} one is the most used since it can be used as is in +a Python doctest. + +\codetitle{An output sample:} +\begin{verbatim} +== +Doctest generated Sun Mar 12 2006 17:07:22 GMT+0100 (CET) +== + +Create the browser object we'll be using. + + from zope.testbrowser import Browser + browser = Browser() + browser.open('http://localhost/') + browser.getLink('++etc++site').click() + browser.getLink('[top]').click() + browser.getLink('Folder').click() + browser.getControl(name='new_value').value = 'MyFolder' + browser.getControl('Apply').click() + browser.getLink('MyFolder').click() + browser.open('http://localhost/') + browser.getLink('[top]').click() + browser.getLink('Folder').click() + browser.getControl(name='new_value').value = 'test' + browser.getControl('Apply').click() + browser.getLink('test').click() +\end{verbatim} + +This piece of Python code can be taken back and modified, to add some +assertions over the pages for examples. \end{solution
[Z3lab-checkins] r2697 - cookbook/trunk
Author: tziade Date: Thu Mar 23 01:22:22 2006 New Revision: 2697 Modified: cookbook/trunk/recipe48.en.tex Log: savepoint Modified: cookbook/trunk/recipe48.en.tex == --- cookbook/trunk/recipe48.en.tex (original) +++ cookbook/trunk/recipe48.en.tex Thu Mar 23 01:22:22 2006 @@ -3,17 +3,160 @@ \include{macros} \status{draft} \author{Tarek Ziad�} +\translator{Tarek Ziad�} \begin{document} \chapter*{Writing reSTructuredText for documentation and doctests} \begin{problem} -Not translated in english yet. +translation to finish + +L'ensemble de la documentation des paquets de Zope est r�alis�e au format +reSTructuredText, ou reST, qui est une �volution du StructuredText. Ce format +fourni une structure simple, qui n'alourdit pas le texte, contrairement � +LaTeX, et peut �tre lu directement. Des outils permettent ensuite de manipuler +ce contenu pour le transformer en HTML, LaTeX, XML ou PDF. + +Cette recette est une \textit{cheatsheet} minimale, qui permet d'�crire des +doctests destin�s � des paquets Zope, une documentation plus compl�te pouvant +�tre trouv� � cette URL: +\url{http://docutils.sourceforge.net/rst.html}. \end{problem} \begin{solution} -Not translated in english yet. +\section*{Structurer le fichier} +Pour organiser un fichier en section, sous-section, sous-sous-section, etc., +il suffit de souligner le titre de la section avec un caract�re dans l'ensemble: +\begin{verbatim} += - ` : ' ~ ^ _ * + # +\end{verbatim} + +A chaque section, si un nouveau caract�re est utilis�, reST l'associe au niveau +donn� pour le reste du document. + +\codetitle{Exemple de structure reST:} +\begin{verbatim} +Titre += + +Ok, donc j'ai deux sections. Profitez-en. + +Section 1 +~ + +Le titre est un frimeur. j'en parle dans une sous-section. + +Sous-Section 1 +-- + +Je suis charg� par ma section de casser du sucre sur le dos +de Titre, mais je n'en ferais rien, je vise une promotion. + +Section 2 +~ + +Calmons nous, le document est fini de toute mani�re... +\end{verbatim} + +\section*{Ins�rer des exemples de code} + +Ins�rer du code se fait en l'indentant d'au minimum 1 caract�re (en g�n�ral 2 +ou 4). Ce bloc doit �tre pr�c�d� du signe :: et d'une ligne vide, puis +suivi d'une ligne vide. + +\codetitle{Insertion de code:} +\begin{verbatim} +Le module Math +== + +Python dispose d'un module math, qui fourni une fonction pour les puissances:: + + import math + math.pow(56, 3) + 175616.0 + +Il y a aussi pi:: + + math.pi + 3.1415926535897931 + +\end{verbatim} +\begin{codenotes} +\item Zope 3 indente de deux caract�res, mais certains d�veloppeurs pr�f�rent +une indentation sur 4 caract�res, peut �tre pour �diter plus facilement +ces fichiers dans leur �diteur de code Python. +\end{codenotes} + +\section*{Ins�rer des liens et formater le texte} + +\noindent reST permet aussi d'afficher du texte en italique, en gras. + +\codetitle{Gras et italique:} +\begin{verbatim} +Recette +=== + +Il n'y a absolument pas de **gras** dans les plats `italiens`. +\end{verbatim} + +\noindent La notation italique est utilis�e pour mettre en exergue un module +ou tout �l�ment de code dans le texte. La notation grasse est r�serv�e � la +mise en valeur de mots du texte. + +Pour les liens, les deux types les plus courants sont les liens complets +vers des ressources Web (URL), et les liens vers une autre partie du document. + +Les URL peuvent �tre associ�s � un texte mis entre simple c�tes, et suivit +d'un espace soulign�. Ce texte est ensuite r�p�t� en bas de document, pr�c�d� +de deux points, un espace , puis un espace soulign�, puis de l'URL pr�c�d� +du symbole :. + +\codetitle{Exemple d'URL:} +\begin{verbatim} +Ordonnance +== + +Matin et soir : un tour sur `zope-cookbook`_ +Midi: Ne pas oublier le suppositoire. + +.. _`zope-cookbook`: http://zope-cookbook.org +\end{verbatim} +\begin{codenotes} +\item La r�f�rence en bas de page disparait bien s�r, lorsque le texte est par +exemple g�n�r� en HTML ou PDF. +\end{codenotes} + +Pour d�finir des liens dans le document m�me, le m�me type de marquage est +employ�, sauf pour la section cible: la phrase r�p�t�e est suivi uniquement +de :. + +\codetitle{Exemple de r�f�rences dans le document:} +\begin{verbatim} +Ordonnance +== + +Matin et soir : un tour sur `zope-cookbook`_ +_`suppositoire`: +Midi: Ne pas oublier le suppositoire. + +_`zope-cookbook`: +Zope-cookbook.org est un site tr�s sympa. Mais avant d'y aller, +avez vous pens� � votre `suppositoire`_ ? +\end{verbatim} + +\section*{Adopter de bonnes pratiques} + +Voici une liste de bonne pratiques en vrac: +\begin{itemize} +\item V�rifier � ce que le fichier reST soit toujours syntaxiquement valide, +avec \code{rest2html} par exemple; +\item regrouper les liens en fin de fichier; +\item les fichiers reST constituent la documentation du paquet, ils doivent +�tre particuli�rement
[Z3lab-checkins] r2657 - cookbook/trunk
Author: tziade Date: Sun Mar 19 00:30:11 2006 New Revision: 2657 Modified: cookbook/trunk/recipe57.fr.tex Log: french version Modified: cookbook/trunk/recipe57.fr.tex == --- cookbook/trunk/recipe57.fr.tex (original) +++ cookbook/trunk/recipe57.fr.tex Sun Mar 19 00:30:11 2006 @@ -9,11 +9,235 @@ \chapter*{Organiser le code dans un paquet} \begin{problem} -Pas encore traduit de l'anglais. +Un paquet est compos� de fichiers Python et ZCML, parfois de Page Templates +et de resources, que ce soit des fichiers CSS, Javascript, ou des images. + +Cette recette explique comment organiser tout ces �l�ments, pour rendre +le paquet facile � maintenir. \end{problem} \begin{solution} -Pas encore traduit de l'anglais. + +\section*{Comprendre ce qu'est un paquet} + +La d�finition d'un paquet en Python est: un r�pertoire contenant des modules +et des sous-r�pertoire, le tout composant un espace de nom ajout� au chemin +de l'interpr�teur. Chaque r�pertoire composant le paquet doit contenir un +fichier \code{\_\_init\_\_.py} pour �tre pris en compte. + +Zope utilise les paquets pour d�finir son code d'extension. Ces paquets +s'appelaient des \textit{Produits} sous Zope 2, puis ont repris le nom plus +pythonique de \textit{paquet} sous Zope 3. Comme l'initialisation d'une +extension se fait par la lecture des directives ZCML, Zope agit comme Python +mais en recherchant pour sa part le fichier \code{configure.zcml} du paquet. + +Aux yeux de Zope, le code peut donc �tre organis� de n'importe quelle mani�re +dans le paquet, du moment qu'il est li� dans le fichier ZCML. Mais pour +faciliter la maintenance et l'�volution, un minimum de structuration est +n�cessaire, bas� sur quelques conventions. + +\section*{D�finir une structure minimum} + +Le plus petit paquet possible est compos� d'un fichier \code{\_\_init\_\_.py} +vide, et d'un fichier \code{configure.zcml} contenant au minimum une directive +\code{configure} vide. + +\codetitle{Le plus petit fichier configure.zcml possible:} +\begin{verbatim} +configure\ +\end{verbatim} + +Ces deux fichiers sont r�unis dans un dossier, qui est d�clar� dans un fichier +de configuration plac� dans le dossier \textit{INSTANCE/etc/package-includes}. +Zope parcourt au d�marrage \textit{package-includes} pour conna�tre la liste +des paquets � initialiser. Les fichiers de ce dossier doivent avoir un nom +avec un suffixe \textit{-configure.zcml}, et utilisent en g�n�ral le nom +du paquet. Le paquet \textit{dummypackage} aura donc comme fichier de +d�claration \textit{dummypackage-configure.zcml}. + +\codetitle{Le fichier dummypackage-configure.zcml:} +\begin{verbatim} +include package=dummypackage/ +\end{verbatim} + +Au d�marrage, Zope int�grera le premier paquet nomm� \code{dummypackage} +trouv� dans son chemin. La meilleure place pour conserver les paquets est +\code{INSTANCE/lib/python}. + +\section*{D�finir une structure plus avanc�e} + +Le paquet \code{dummypackage} va maintenant impl�menter une fonctionnalit� +simple, qui se base sur une structure typique: un nouveau type d'objet +qui conserve en interne le nombre de fois qu'il a �t� appel� par une vue. +Le paquet a donc besoin de d�finir: + +\begin{itemize} +\item Une d�claration d'interface; +\item une classe de contenu. +\item une classe de vue; +\end{itemize} + +\subsection*{D�claration d'interface} + +Toutes les d�clarations d'interface d'un paquet sont r�unies dans un fichier +unique nomm� {interfaces.py}. Cette convention offre: + +\begin{itemize} +\item Une mani�re unique de faire r�f�rence � des interfaces. Par exemple, +l'attribut \code{for} d'une directive \code{browser:view} est toujours de la +forme : \textit{package.interfaces.IMyInterface}. +\item Des facilit�s pour organiser l'h�ritage entre les interfaces. +\end{itemize} + +L'interface de l'exemple se nomme \code{IDummyCounter} et est ajout�e au +fichier \code{interfaces.py}. + +\codetitle{interfaces.py:} +\begin{verbatim} +from zope.interface import Interface + +class IDummyCounter(Interface): + +def count(): + returns the counter value +after it has been inc'ed + +\end{verbatim} + +\subsection*{Classe de contenu} + +La classe de contenu g�re le compteur, et d�rive d'une classe persistante de +base, qui permet son stockage dans la ZODB. Cette classe est sauvegard�e dans +un fichier portant le m�me nom. + +\codetitle{dummycounter.py:} +\begin{verbatim} +import persistent +from zope.interface import implements +from interfaces import IDummyCounter + +class DummyCounter(persistent.Persistent): + +implements(IDummyCounter) + +def __init__(self, initial=0): +self._count = initial + +def count(self): +self._count += 1 +return self._count + +\end{verbatim} + +\code{DummyCounter} est d�j� fonctionnel. + +\codetitle{Tests de DummyCounter dans un prompt:} +\begin{verbatim} + from dummypackage.dummycounter import DummyCounter
[Z3lab-checkins] r2658 - cookbook/trunk
Author: tziade Date: Sun Mar 19 00:31:14 2006 New Revision: 2658 Modified: cookbook/trunk/recipe57.en.tex Log: tipos Modified: cookbook/trunk/recipe57.en.tex == --- cookbook/trunk/recipe57.en.tex (original) +++ cookbook/trunk/recipe57.en.tex Sun Mar 19 00:31:14 2006 @@ -46,7 +46,7 @@ \end{verbatim} These two files are gathered in a folder, which is declared in a configuration -file in the \code{INSTANCE/etc/package-includes} folder. The configuration file +file in the \textit{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 to complete its name. So a package called \textit{dummypackage} will have a \textit{dummypackage-configure.zcml} file, @@ -62,14 +62,14 @@ \section*{Setting up a real-world structure} -The \code{dummy} package will now implement a simple feature to demonstrate -a typical structure: a new kind of object that keep a track of the number -of times it has been accessed through a view. The package therefore needs: +The \code{dummypackage} package will now implement a simple feature to +demonstrate a typical structure: a new kind of object that keep a track of the +number of times it has been accessed through a view. The package therefore needs: \begin{itemize} \item An interface declaration; -\item a view class; \item a content class. +\item a view class; \end{itemize} \subsection*{Interface declaration} @@ -227,8 +227,9 @@ This structure is a module-based structure, and fits well for our simple example. When the package gets bigger, it's better to use a folder-based organization, by making \code{interfaces} and \code{browser} become -subfolders. The \code{browser} folder can then hold its own -\code{configure.zcml}, included in the main ZCML file, and so forth. +subfolders. The \code{browser} folder define modules for view and holds its +own \code{configure.zcml}, included in the main ZCML file, and so forth. +The \code{interfaces} folder holds modules for interfaces. \end{solution} \end{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2646 - cookbook/trunk
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
[Z3lab-checkins] r2648 - cookbook/trunk
Author: tziade Date: Thu Mar 16 22:33:16 2006 New Revision: 2648 Modified: cookbook/trunk/recipe_list.txt Log: added recipes Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Thu Mar 16 22:33:16 2006 @@ -49,6 +49,7 @@ 21 - creating a object with forms 22 - understanding Events 23 - using Events +24 - setting up a development environment (xx path) - ... Developping Zope - real-world recipes @@ -73,6 +74,7 @@ 56 - testing forms with zope.testbrowser 57 - organizing the code in a package 58 - learning naming conventions +59 - creating a new content object - ... Developping Zope - advanced recipes -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2643 - cookbook/trunk
Author: tziade Date: Wed Mar 15 22:42:20 2006 New Revision: 2643 Modified: cookbook/trunk/recipe_list.txt Log: adding an important recipe Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Wed Mar 15 22:42:20 2006 @@ -71,6 +71,7 @@ 54 - using ldap to store users 55 - using a sql database to store data 56 - testing forms with zope.testbrowser +57 - organizing code in a package - ... Developping Zope - advanced recipes -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2645 - cookbook/trunk
Author: tziade Date: Thu Mar 16 01:22:14 2006 New Revision: 2645 Added: cookbook/trunk/recipe57.en.tex cookbook/trunk/recipe57.fr.tex Modified: cookbook/trunk/recipe_list.txt Log: added recipe 57 Added: cookbook/trunk/recipe57.en.tex == --- (empty file) +++ cookbook/trunk/recipe57.en.tex Thu Mar 16 01:22:14 2006 @@ -0,0 +1,35 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Organizing the code in a package} + +\begin{problem} +Packages are 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. +\end{problem} + +\begin{solution} + +\section*{Understanding what is a package} + +\section*{Setting up the minimum structure} + +\subsection*{Choosing between module-based or file-based} + +\section*{Adding tests} + +\section*{Adding specific elements} + +\section*{Splitting up a growing package} + +\end{solution} + +\end{document} Added: cookbook/trunk/recipe57.fr.tex == --- (empty file) +++ cookbook/trunk/recipe57.fr.tex Thu Mar 16 01:22:14 2006 @@ -0,0 +1,19 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Organiser le code dans un paquet} + +\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 01:22:14 2006 @@ -71,7 +71,7 @@ 54 - using ldap to store users 55 - using a sql database to store data 56 - testing forms with zope.testbrowser -57 - organizing code in a package +57 - organizing the code in a package - ... Developping Zope - advanced recipes -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2616 - cookbook/trunk
Author: tziade Date: Sun Mar 12 15:13:37 2006 New Revision: 2616 Modified: cookbook/trunk/recipe07.fr.tex cookbook/trunk/recipe48.fr.tex cookbook/trunk/recipe50.fr.tex cookbook/trunk/recipe51.fr.tex Log: ran spellchecker Modified: cookbook/trunk/recipe07.fr.tex == --- cookbook/trunk/recipe07.fr.tex (original) +++ cookbook/trunk/recipe07.fr.tex Sun Mar 12 15:13:37 2006 @@ -6,7 +6,7 @@ \begin{document} -\chapter*{\'Ecrire des tests fonctionnels} +\chapter*{�crire des tests fonctionnels} \begin{problem} Les tests fonctionnels, ou acceptance tests, sont compl�mentaires aux @@ -24,8 +24,8 @@ approximativement 2/3 de tests unitaires et 1/3 de tests fonctionnels, ces derniers �tant de plus haut niveau. -Pour les applications web, ces tests n�cessitent un environnement d'ex�cution -particulier, qui imite au mieux un naviguateur, et fourni des APIs pour +Pour les applications Web, ces tests n�cessitent un environnement d'ex�cution +particulier, qui imite au mieux un navigateur, et fourni des Apis pour effectuer des requ�tes et �tudier les r�ponses, comme le ferait Firefox ou Internet Explorer. \end{problem} @@ -37,9 +37,9 @@ d'une application, sans se soucier des d�tails d'impl�mentation, contrairement aux tests unitaires. C'est le test pratiqu� par l'utilisateur final, qui peut par exemple parcourir les menus de l'application, pour tester chacun d'entre -eux. Il valide alors, muni d'une checklist, que chaque fonctionnalit� attendue +eux. Il valide alors, muni d'une check-list, que chaque fonctionnalit� attendue est bien pr�sente et se comporte comme souhait�. Le syst�me est alors valid� -si la checklist n'a aucun point manquant ou non conforme. +si la check-list n'a aucun point manquant ou non conforme. Les tests fonctionnels en Python et a fortiori avec Zope, se font par le biais de classes de tests d�riv�es des classe de tests unitaires, ou @@ -73,14 +73,14 @@ le site pour les r�f�rences relatives. \end{itemize} -L'object \code{Response} est un objet renvoy� par le publisher et augment� +L'objet \code{Response} est un objet renvoy� par le publisher et augment� par les outils de tests de quelques m�thodes facilitant la lecture. On retiendra surtout: \begin{itemize} \item \code{getBody()}: renvoie le corps de la r�ponse \item \code{getOutput()}: renvoie la r�ponse compl�te (corps et en-t�tes) -\item \code{getStatus()}: renvoie le status -\item \code{getHeaders()}: permet de r�cuperer les headers +\item \code{getStatus()}: renvoie le statut +\item \code{getHeaders()}: permet de r�cup�rer les en-t�tes \end{itemize} Dans l'exemple ci-dessous, un dossier est cr�� dans le dossier racine, @@ -147,7 +147,7 @@ Le module \code{doctest} de Python fourni des outils pour extraire et ex�cuter ces tests. -\codetitle{Execution du doctest:} +\codetitle{Ex�cution du doctest:} \begin{Verbatim} import doctest doctest.run_docstring_examples(laVerite, globals(), verbose=True) @@ -191,7 +191,7 @@ Pour manipuler facilement Zope dans les doctests, le paquet \code{zope.testbrowser} fourni une classe \code{Browser} qui permet -de simuler un naviguateur et ses fonctionalit�s. Par convention, cette classe +de simuler un navigateur et ses fonctionalit�s. Par convention, cette classe est invoqu�e avec une URL qui commence par \url{http://localhost}, puis le chemin sur le serveur Zope. @@ -216,11 +216,11 @@ \code{Browser}, outre \code{contents} et \code{url}, fournit les �l�ments principaux suivants: \begin{itemize} -\item \code{open(url)}: permet d'ouvrir l'url fournie. +\item \code{open(url)}: permet d'ouvrir l'URL fournie. \item \code{isHtml}: le contenu est-il du HTML ? \item \code{title}: renvoie directement le titre de la page. \item \code{headers}: renvoie un objet Python \code{httplib.HTTPMessage} -contenant les headers. +contenant les en-t�tes. \item \code{getLink(text)} : r�cup�re un objet \code{Link}�pour le lien repr�sent� par \code{text}. Ce lien peut ensuite �tre suivi par sa m�thode \code{click()}, pour recharger la nouvelle page dans l'instance @@ -232,9 +232,9 @@ \section*{Limitations des tests fonctionnels} -Les tests fonctionnels web ont une limitation inh�rente au fonctionnement des -naviguateurs: il est impossible de tester le javascript contenu dans les pages -car chaque naviguateur impl�mente son propre moteur. Il faut utiliser d'autres +Les tests fonctionnels Web ont une limitation inh�rente au fonctionnement des +navigateurs: il est impossible de tester le javascript contenu dans les pages +car chaque navigateur impl�mente son propre moteur. Il faut utiliser d'autres techniques, bas�es par exemple sur le syst�me de test \textit{Selenium}, qui lance les tests depuis un naviguateur r�el. \end{solution} Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48
[Z3lab-checkins] r2618 - cookbook/trunk
Author: tziade Date: Sun Mar 12 17:16:48 2006 New Revision: 2618 Modified: cookbook/trunk/recipe00.fr.tex Log: spelling Modified: cookbook/trunk/recipe00.fr.tex == --- cookbook/trunk/recipe00.fr.tex (original) +++ cookbook/trunk/recipe00.fr.tex Sun Mar 12 17:16:48 2006 @@ -18,7 +18,7 @@ Une recette est compos�e de deux sections: 'problem' et 'solution'. \begin{itemize} -\item La section problem d�crit en 20 lignes le probl�me que la recette r�soud. +\item La section problem d�crit en 20 lignes le probl�me que la recette r�sout. \item La section solution est form�e de 'sections' et 'subsections', et fourni la solution. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2619 - cookbook/trunk
Author: tziade Date: Sun Mar 12 17:18:14 2006 New Revision: 2619 Modified: cookbook/trunk/recipe51.fr.tex Log: added a quick tutorial on zope.testrecorder, that should be enough detailed so people knowing selenium *or* zope.testbrowser can use it Modified: cookbook/trunk/recipe51.fr.tex == --- cookbook/trunk/recipe51.fr.tex (original) +++ cookbook/trunk/recipe51.fr.tex Sun Mar 12 17:18:14 2006 @@ -17,11 +17,108 @@ Programmer une session Web compl�te par code est fastidieux. Cette recette pr�sente des techniques pour enregistrer des actions r�alis�es -dans un vrai navigateur, et les r�cup�rer pour les tests fonctionnels. +dans un vrai navigateur, et les r�cup�rer pour acc�l�rer l'�criture des +tests fonctionnels. \end{problem} \begin{solution} -TODO + +\section*{Conna�tre le paquet zope.app.recorder} + +Zope 3 fournit \code{zope.app.recorder}, qui permet d'ajouter un +publisher particulier au fichier \code{zope.conf}, en charge d'enregistrer les +manipulations de l'utilisateur. Le probl�me avec cet outil est que le r�sultat +est compos� des �changes HTTP bruts. Recycler ces r�sultats pour les +transformer en �change exploitables avec, par exemple \code{zope.testbrowser}, +peut �tre aussi fastidieux. + +\section*{Utiliser le paquet zope.testrecorder} + +Zope Corp a d�velopp� un petit outil, appel� \code{zope.testrecorder}, qui +offre le m�me style de fonctionnalit�, mais avec des sorties dans deux +formats plus facilement recyclables: +\begin{itemize} +\item \code{Python Doctest} directement exploitable avec +\code{zope.testbrowser}; +\item \code{Selenium Test}, qui peut �tre utilis� avec \code{Selenium}. +\end{itemize} + +\subsection*{Installer} + +L'outil ne fait pas parti de Zope 3, et doit �tre r�cup�r� s�par�ment. Il ne +dispose pas non plus d'un site Web, ou d'une distribution par archive. Il faut +donc r�cup�rer ce paquet directement sur le subversion de Zope.org, et le placer dans +le r�pertoire \code{/lib/python} de l'instance de Zope. + +\codetitle{R�cup�ration de zope.testrecorder par subversion} +\begin{verbatim} [EMAIL PROTECTED]:~$ cd /home/zopes/zope3/lib/python/ [EMAIL PROTECTED]:/home/zopes/zope3/lib/python$ svn co svn://svn.zope.org/repos/main/zope.testrecorder/trunk testrecorder +Atestrecorder/html +Atestrecorder/html/recorder.js +[...] +Atestrecorder/testrecorder.py +R�vision 65919 extraite. +\end{verbatim} + +Le paquet est ensuite pr�sent� � Zope par le biais d'un fichier +d'initialisation, appel� \code{testrecorder-configure.zcml}, plac� dans le +r�pertoire \code{etc/package-includes} de l'instance, avec le contenu +ci-dessous. + +\codetitle{Le fichier testrecorder-configure.zcml} +\begin{verbatim} +include package=testrecorder / +\end{verbatim} + +Zope, en red�marrant, poss�de un nouveau dossier nomm� \code{recorder}, et +d�clar� comme resource pointant sur le r�pertoire \code{html} du paquet. + +\subsection*{Enregistrer une session} + +Une fois install�, \code{testrecorder} est accessible via +\url{\@@\recorder\index.html}. Cette page pr�sente une banni�re o� le +testeur peut saisir une URL et commencer � enregistrer une session. La page +visit�e appara�t sous la banni�re et le testeur peut circuler sur le site. + +Le bouton \code{Stop Recording} permet d'arr�ter l'enregistrement. + +\subsection*{R�cup�rer les r�sultats} + +Une fois la session effectu�e, \code{testrecorder} propose deux sorties, +qui apparaissent dans le navigateur. La sortie \code{Python Doctest} est +la plus fr�quemment utilis�e, puisqu'elle permet de r�cup�rer une portion +de code Python pouvant �tre utilis�e telle quelle dans un doctest. + +\codetitle{Exemple de sortie de type doctest} +\begin{verbatim} +== +Doctest generated Sun Mar 12 2006 17:07:22 GMT+0100 (CET) +== + +Create the browser object we'll be using. + + from zope.testbrowser import Browser + browser = Browser() + browser.open('http://localhost/') + browser.getLink('++etc++site').click() + browser.getLink('[top]').click() + browser.getLink('Folder').click() + browser.getControl(name='new_value').value = 'MyFolder' + browser.getControl('Apply').click() + browser.getLink('MyFolder').click() + browser.open('http://localhost/') + browser.getLink('[top]').click() + browser.getLink('Folder').click() + browser.getControl(name='new_value').value = 'test' + browser.getControl('Apply').click() + browser.getLink('test').click() +\end{verbatim} + +Cette portion de doctest peut ensuite �tre modifi�e pour ajouter des tests +compl�mentaires, pour v�rifier des �l�ments sur chacune des pages de la +session. + \end{solution} \end{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2620 - cookbook/trunk
Author: tziade Date: Sun Mar 12 17:20:08 2006 New Revision: 2620 Modified: cookbook/trunk/cookbook.en.kilepr cookbook/trunk/cookbook.fr.kilepr cookbook/trunk/recipe51.fr.tex cookbook/trunk/tests.py Log: better sentence Modified: cookbook/trunk/cookbook.en.kilepr == --- cookbook/trunk/cookbook.en.kilepr (original) +++ cookbook/trunk/cookbook.en.kilepr Sun Mar 12 17:20:08 2006 @@ -41,30 +41,30 @@ archive=true column=0 encoding= -highlight= +highlight=LaTeX line=0 -open=false +open=true [item:recipe49.en.tex] archive=true column=0 encoding= -highlight= +highlight=LaTeX line=0 -open=false +open=true [item:recipe50.en.tex] archive=true column=0 encoding= -highlight= +highlight=LaTeX line=0 -open=false +open=true [item:recipe51.en.tex] archive=true -column=1 +column=0 encoding= -highlight= +highlight=LaTeX line=0 -open=false +open=true Modified: cookbook/trunk/cookbook.fr.kilepr == --- cookbook/trunk/cookbook.fr.kilepr (original) +++ cookbook/trunk/cookbook.fr.kilepr Sun Mar 12 17:20:08 2006 @@ -1,7 +1,7 @@ [General] img_extIsRegExp=false img_extensions=.eps .pdf .dvi .ps .fig .gif .jpg .jpeg .png -lastDocument=file:///home/svn.z3lab.org/cookbook/recipe48.fr.tex +lastDocument=file:///home/svn.z3lab.org/cookbook/recipe00.fr.tex masterDocument= name=Zope 3 Cookbook, Français pkg_extIsRegExp=false @@ -15,15 +15,15 @@ [item:cookbook.fr.kilepr] archive=true -column=29 +column=0 encoding=ISO 8859-15 highlight=None -line=7 +line=0 open=false [item:recipe00.fr.tex] archive=true -column=0 +column=11 encoding=ISO 8859-15 highlight=LaTeX line=0 @@ -39,10 +39,10 @@ [item:recipe48.fr.tex] archive=true -column=30 +column=28 encoding=ISO 8859-15 highlight=LaTeX -line=27 +line=106 open=true [item:recipe49.fr.tex] @@ -55,16 +55,16 @@ [item:recipe50.fr.tex] archive=true -column=77 +column=39 encoding=ISO 8859-15 highlight=LaTeX -line=168 +line=153 open=true [item:recipe51.fr.tex] archive=true -column=13 +column=14 encoding=ISO 8859-15 highlight=LaTeX -line=20 +line=4 open=true Modified: cookbook/trunk/recipe51.fr.tex == --- cookbook/trunk/recipe51.fr.tex (original) +++ cookbook/trunk/recipe51.fr.tex Sun Mar 12 17:20:08 2006 @@ -29,8 +29,8 @@ publisher particulier au fichier \code{zope.conf}, en charge d'enregistrer les manipulations de l'utilisateur. Le probl�me avec cet outil est que le r�sultat est compos� des �changes HTTP bruts. Recycler ces r�sultats pour les -transformer en �change exploitables avec, par exemple \code{zope.testbrowser}, -peut �tre aussi fastidieux. +transformer en donn�es facilement exploitables avec, par exemple +\code{zope.testbrowser}, peut �tre aussi fastidieux. \section*{Utiliser le paquet zope.testrecorder} Modified: cookbook/trunk/tests.py == --- cookbook/trunk/tests.py (original) +++ cookbook/trunk/tests.py Sun Mar 12 17:20:08 2006 @@ -78,6 +78,7 @@ if file.endswith('.tex')] tests = [FunctionalTexFileSuite(file) for file in files] +import pdb; pdb.set_trace() return unittest.TestSuite(tests) if __name__ == '__main__': -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2622 - cookbook/trunk
Author: tziade Date: Sun Mar 12 17:52:17 2006 New Revision: 2622 Modified: cookbook/trunk/recipe51.fr.tex Log: missing comma Modified: cookbook/trunk/recipe51.fr.tex == --- cookbook/trunk/recipe51.fr.tex (original) +++ cookbook/trunk/recipe51.fr.tex Sun Mar 12 17:52:17 2006 @@ -38,7 +38,7 @@ offre le m�me style de fonctionnalit�, mais avec des sorties dans deux formats plus facilement recyclables: \begin{itemize} -\item \code{Python Doctest} directement exploitable avec +\item \code{Python Doctest}, directement exploitable avec \code{zope.testbrowser}; \item \code{Selenium Test}, qui peut �tre utilis� avec \code{Selenium}. \end{itemize} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2624 - cookbook/trunk
Author: tziade Date: Sun Mar 12 17:53:52 2006 New Revision: 2624 Modified: cookbook/trunk/tests.py Log: ooops, commited a pdb Modified: cookbook/trunk/tests.py == --- cookbook/trunk/tests.py (original) +++ cookbook/trunk/tests.py Sun Mar 12 17:53:52 2006 @@ -78,7 +78,6 @@ if file.endswith('.tex')] tests = [FunctionalTexFileSuite(file) for file in files] -import pdb; pdb.set_trace() return unittest.TestSuite(tests) if __name__ == '__main__': -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2625 - in cookbook/trunk: . media
Author: tziade Date: Sun Mar 12 18:16:06 2006 New Revision: 2625 Added: cookbook/trunk/media/ cookbook/trunk/media/recipe51.screenshot1.png (contents, props changed) Modified: cookbook/trunk/macros.tex cookbook/trunk/recipe51.fr.tex Log: added a zope.testrecorder screenshot Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Sun Mar 12 18:16:06 2006 @@ -52,3 +52,8 @@ #1 \end{comment} } + +\newcommand{\legend}[1] { +\noindent\emph{\underline{#1}} +} + Added: cookbook/trunk/media/recipe51.screenshot1.png == Binary file. No diff available. Modified: cookbook/trunk/recipe51.fr.tex == --- cookbook/trunk/recipe51.fr.tex (original) +++ cookbook/trunk/recipe51.fr.tex Sun Mar 12 18:16:06 2006 @@ -83,6 +83,12 @@ Le bouton \code{Stop Recording} permet d'arr�ter l'enregistrement. +\begin{center} +\includegraphics[bb=0 0 302 270]{media/recipe51.screenshot1.png} +% recipe51.screenshot1.png: 72.009dpi, width=10.65cm, height=9.52cm, bb=0 0 302 270 +\legend{zope.testrecorder en action} +\end{center} + \subsection*{R�cup�rer les r�sultats} Une fois la session effectu�e, \code{testrecorder} propose deux sorties, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2627 - cookbook/trunk
Author: tziade Date: Sun Mar 12 19:02:54 2006 New Revision: 2627 Modified: cookbook/trunk/recipe51.fr.tex Log: tipos Modified: cookbook/trunk/recipe51.fr.tex == --- cookbook/trunk/recipe51.fr.tex (original) +++ cookbook/trunk/recipe51.fr.tex Sun Mar 12 19:02:54 2006 @@ -9,7 +9,7 @@ \chapter*{Enregistrer une session utilisateur pour les tests} \begin{problem} -L'�criture d'un test fonctionnel est en souvent dict� par un sc�nario +L'�criture d'un test fonctionnel est souvent dict�e par un sc�nario d'utilisation pr�cis, ou user story, o� chaque �tape est r�alis�e via l'interface homme-machine fournie. Dans notre cas, l'interface est bien s�r le navigateur. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2628 - cookbook/trunk
Author: tziade Date: Sun Mar 12 19:31:20 2006 New Revision: 2628 Modified: cookbook/trunk/recipe49.en.tex cookbook/trunk/recipe49.fr.tex cookbook/trunk/recipe_list.txt Log: changed recipe title, the previous one sucked big time Modified: cookbook/trunk/recipe49.en.tex == --- cookbook/trunk/recipe49.en.tex (original) +++ cookbook/trunk/recipe49.en.tex Sun Mar 12 19:31:20 2006 @@ -6,7 +6,7 @@ \begin{document} -\chapter*{Using zapi in tests} +\chapter*{Interacting with Zope in tests} \begin{problem} Not translated in english yet. Modified: cookbook/trunk/recipe49.fr.tex == --- cookbook/trunk/recipe49.fr.tex (original) +++ cookbook/trunk/recipe49.fr.tex Sun Mar 12 19:31:20 2006 @@ -6,7 +6,7 @@ \begin{document} -\chapter*{Utiliser zapi dans les tests} +\chapter*{Interagir avec Zope dans les tests} \begin{problem} TODO Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Sun Mar 12 19:31:20 2006 @@ -62,7 +62,7 @@ 46 - creating multilanguage content objects 47 - changing and migrating existing objects 48 - writing reSTructuredText for documentation and doctests (TZ) -49 - using zapi in tests (TZ) +49 - interacting with zope in tests (TZ) 50 - organizing tests in a package (TZ) 51 - finding the good pace between coding, documenting, unit testing and functional testing (TZ) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2581 - cookbook/trunk
Author: tziade Date: Sat Mar 11 17:50:30 2006 New Revision: 2581 Added: cookbook/trunk/recipe7.en.tex Log: added english recipe 7 Added: cookbook/trunk/recipe7.en.tex == --- (empty file) +++ cookbook/trunk/recipe7.en.tex Sat Mar 11 17:50:30 2006 @@ -0,0 +1,19 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Writing functionnal tests} + +\begin{problem} +Not translated in english yet. +\end{problem} + +\begin{solution} +Not translated in english yet. +\end{solution} + +\end{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2586 - cookbook/trunk
Author: tziade Date: Sat Mar 11 20:11:15 2006 New Revision: 2586 Added: cookbook/trunk/configure.zcml Log: added mandatory file Added: cookbook/trunk/configure.zcml == --- (empty file) +++ cookbook/trunk/configure.zcml Sat Mar 11 20:11:15 2006 @@ -0,0 +1,7 @@ +configure +xmlns=http://namespaces.zope.org/zope; +xmlns:i18n=http://namespaces.zope.org/i18n; +i18n_domain=cookbook + + +/configure -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2587 - cookbook/trunk
Author: tziade Date: Sat Mar 11 20:13:14 2006 New Revision: 2587 Modified: cookbook/trunk/recipe48.fr.tex cookbook/trunk/recipe50.fr.tex Log: corrected tests Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48.fr.tex (original) +++ cookbook/trunk/recipe48.fr.tex Sat Mar 11 20:13:14 2006 @@ -71,6 +71,7 @@ math.pi 3.1415926535897931 + \end{verbatim} \begin{codenotes} \item Zope 3 indente de deux caract�res, mais certains d�veloppeurs pr�f�rent Modified: cookbook/trunk/recipe50.fr.tex == --- cookbook/trunk/recipe50.fr.tex (original) +++ cookbook/trunk/recipe50.fr.tex Sat Mar 11 20:13:14 2006 @@ -131,6 +131,7 @@ from rssfetcher import fetchFeed fetchFeed('tests/rss.xml') [{'Subject': 'entry one', 'content': le contenu est ici}] + \end{verbatim} \begin{codenotes} \item Le paquet doit pr�voir dans un sous r�pertoire un fichier -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2591 - cookbook/trunk
Author: tziade Date: Sun Mar 12 01:02:16 2006 New Revision: 2591 Modified: cookbook/trunk/recipe7.fr.tex Log: accent on E Modified: cookbook/trunk/recipe7.fr.tex == --- cookbook/trunk/recipe7.fr.tex (original) +++ cookbook/trunk/recipe7.fr.tex Sun Mar 12 01:02:16 2006 @@ -6,7 +6,7 @@ \begin{document} -\chapter*{Ecrire des tests fonctionnels} +\chapter*{\'Ecrire des tests fonctionnels} \begin{problem} Les tests fonctionnels, ou acceptance tests, sont compl�mentaires aux -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2592 - cookbook/trunk
Author: tziade Date: Sun Mar 12 01:03:12 2006 New Revision: 2592 Modified: cookbook/trunk/recipe50.fr.tex Log: oops, z3 is not under trac, so: trac - tracker Modified: cookbook/trunk/recipe50.fr.tex == --- cookbook/trunk/recipe50.fr.tex (original) +++ cookbook/trunk/recipe50.fr.tex Sun Mar 12 01:03:12 2006 @@ -166,7 +166,7 @@ Cependant, si il est explicitement demand� que les bugfix soient document�s, et facilement lisibles, un doctest \code{bugfix.txt} peut �tre ajout�. -Ce n'est pas le cas pour Zope 3 par exemple, car le couple trac+svn fourni +Ce n'est pas le cas pour Zope 3 par exemple, car le couple tracker+svn fourni une bonne tracabilit� des bugfix. \end{solution} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2593 - cookbook/trunk
Author: tziade Date: Sun Mar 12 01:17:34 2006 New Revision: 2593 Modified: cookbook/trunk/cookbook.en.kilepr cookbook/trunk/cookbook.fr.kilepr cookbook/trunk/recipe7.fr.tex Log: adding infos about zope.testbrowser (not too much because a recipe will explain it further) Modified: cookbook/trunk/cookbook.en.kilepr == --- cookbook/trunk/cookbook.en.kilepr (original) +++ cookbook/trunk/cookbook.en.kilepr Sun Mar 12 01:17:34 2006 @@ -16,7 +16,55 @@ [item:cookbook.en.kilepr] archive=true column=0 +encoding=UTF-8 +highlight=None +line=0 +open=false + +[item:recipe0.en.tex] +archive=true +column=0 +encoding=UTF-8 +highlight=LaTeX +line=0 +open=true + +[item:recipe48.en.tex] +archive=true +column=0 encoding= highlight= line=0 open=false + +[item:recipe49.en.tex] +archive=true +column=0 +encoding= +highlight= +line=0 +open=false + +[item:recipe50.en.tex] +archive=true +column=0 +encoding= +highlight= +line=0 +open=false + +[item:recipe51.en.tex] +archive=true +column=1 +encoding= +highlight= +line=0 +open=false + +[item:recipe7.en.tex] +archive=true +column=0 +encoding=UTF-8 +highlight=LaTeX +line=0 +open=true Modified: cookbook/trunk/cookbook.fr.kilepr == --- cookbook/trunk/cookbook.fr.kilepr (original) +++ cookbook/trunk/cookbook.fr.kilepr Sun Mar 12 01:17:34 2006 @@ -1,7 +1,7 @@ [General] img_extIsRegExp=false img_extensions=.eps .pdf .dvi .ps .fig .gif .jpg .jpeg .png -lastDocument=file:///home/svn.z3lab.org/cookbook/recipe0.fr.tex +lastDocument=file:///home/svn.z3lab.org/cookbook/recipe7.fr.tex masterDocument= name=Zope 3 Cookbook, Français pkg_extIsRegExp=false @@ -15,10 +15,10 @@ [item:cookbook.fr.kilepr] archive=true -column=11 -encoding=UTF-8 +column=29 +encoding=ISO 8859-15 highlight=None -line=13 +line=7 open=false [item:recipe0.fr.tex] @@ -31,10 +31,10 @@ [item:recipe48.fr.tex] archive=true -column=0 +column=16 encoding=ISO 8859-15 highlight=LaTeX -line=0 +line=8 open=true [item:recipe49.fr.tex] @@ -47,10 +47,10 @@ [item:recipe50.fr.tex] archive=true -column=0 +column=14 encoding=ISO 8859-15 highlight=LaTeX -line=0 +line=14 open=true [item:recipe51.fr.tex] Modified: cookbook/trunk/recipe7.fr.tex == --- cookbook/trunk/recipe7.fr.tex (original) +++ cookbook/trunk/recipe7.fr.tex Sun Mar 12 01:17:34 2006 @@ -213,7 +213,22 @@ HTML indiqu�e. \end{codenotes} -AFINIR ici +\code{Browser}, outre \code{contents} et \code{url}, fournit les �l�ments +principaux suivants: +\begin{itemize} +\item \code{open(url)}: permet d'ouvrir l'url fournie. +\item \code{isHtml}: le contenu est-il du HTML ? +\item \code{title}: renvoie directement le titre de la page. +\item \code{headers}: renvoie un objet Python \code{httplib.HTTPMessage} +contenant les headers. +\item \code{getLink(text)} : r�cup�re un objet \code{Link}�pour le lien +repr�sent� par \code{text}. Ce lien peut ensuite �tre suivi par sa +m�thode \code{click()}, pour recharger la nouvelle page dans l'instance +de \code{Browser}. +\end{itemize} + +Des �l�ments suppl�mentaires sont propos�s mais cet outil est pr�sent� +plus en d�tail dans d'autres recettes. \section*{Limitations des tests fonctionnels} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2595 - cookbook/trunk
Author: tziade Date: Sun Mar 12 01:22:59 2006 New Revision: 2595 Modified: cookbook/trunk/recipe_list.txt Log: removed initials, should be set when really starting the recipe Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Sun Mar 12 01:22:59 2006 @@ -70,7 +70,7 @@ 53 - organizing the code in a package (TZ) 54 - using ldap to store users 55 - using a sql database to store data -56 - testing forms with zope.testbrowser (TZ) +56 - testing forms with zope.testbrowser - ... Developping Zope - advanced recipes -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2596 - cookbook/trunk
Author: tziade Date: Sun Mar 12 01:25:23 2006 New Revision: 2596 Modified: cookbook/trunk/macros.tex Log: removed 'Problème' title, looked ugly on the website, plus it's not i18ned Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Sun Mar 12 01:25:23 2006 @@ -12,10 +12,9 @@ \newenvironment{problem} { -\emph{\large{Probl�me}} -\begin{quote} +\begin{quotation} } -{\end{quote}} +{\end{quotation}} \newenvironment{solution} { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2598 - cookbook/trunk
Author: tziade Date: Sun Mar 12 01:34:39 2006 New Revision: 2598 Modified: cookbook/trunk/macros.tex Log: added a title Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Sun Mar 12 01:34:39 2006 @@ -42,6 +42,8 @@ \newenvironment{codenotes} {\hrule +\vspace{4pt} +Notes: \begin{list}{}{\setlength{\leftmargin}{1em}} } {\end{list}\vspace{4pt}} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2602 - cookbook/trunk
Author: tziade Date: Sun Mar 12 02:05:24 2006 New Revision: 2602 Modified: cookbook/trunk/recipe48.fr.tex Log: tipo Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48.fr.tex (original) +++ cookbook/trunk/recipe48.fr.tex Sun Mar 12 02:05:24 2006 @@ -134,7 +134,7 @@ == Matin et soir : un tour sur `zope-cookbook` -_`suppositoire` +_`suppositoire`: Midi: Ne pas oublier le suppositoire. _`zope-cookbook`: -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2603 - cookbook/trunk
Author: tziade Date: Sun Mar 12 02:11:46 2006 New Revision: 2603 Modified: cookbook/trunk/recipe48.fr.tex Log: added a few rest good practices Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48.fr.tex (original) +++ cookbook/trunk/recipe48.fr.tex Sun Mar 12 02:11:46 2006 @@ -144,7 +144,16 @@ \section*{Bonnes pratiques en vrac} -AFINIR +Voici une liste de bonne pratiques reST: +\begin{itemize} +\item V�rifier � ce que le fichier reST soit toujours syntaxiquement valide, +avec \code{rest2html} par exemple; +\item regrouper les liens en fin de fichier; +\item les fichiers reST constituent la documentation du package, ils doivent +�tre particuli�rement soign�s ; +\item Les en-t�tes de modules, de classes et autres fonctions peuvent aussi +adopter ce format. +\end{itemize} \end{solution} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2604 - cookbook/trunk
Author: tziade Date: Sun Mar 12 02:14:10 2006 New Revision: 2604 Modified: cookbook/trunk/recipe48.fr.tex Log: using a verb for section title, like for all sections Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48.fr.tex (original) +++ cookbook/trunk/recipe48.fr.tex Sun Mar 12 02:14:10 2006 @@ -142,9 +142,9 @@ avez vous pens� � votre `suppositoire`_ ? \end{verbatim} -\section*{Bonnes pratiques en vrac} +\section*{Adopter de bonnes pratiques} -Voici une liste de bonne pratiques reST: +Voici une liste de bonne pratiques en vrac: \begin{itemize} \item V�rifier � ce que le fichier reST soit toujours syntaxiquement valide, avec \code{rest2html} par exemple; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2606 - cookbook/trunk
Author: tziade Date: Sun Mar 12 02:19:30 2006 New Revision: 2606 Modified: cookbook/trunk/recipe50.fr.tex Log: specifying what is RUP Modified: cookbook/trunk/recipe50.fr.tex == --- cookbook/trunk/recipe50.fr.tex (original) +++ cookbook/trunk/recipe50.fr.tex Sun Mar 12 02:19:30 2006 @@ -38,8 +38,8 @@ fonctionnels plus pouss�s peut suivre cette phase, puis un retour vers le d�veloppement est envisageable, pour des modifications, �volutions ou d�bugguages. Ces cycles de vie logiciels sont plus ou moins �quivalents -dans toutes les m�thodologies existantes, comme le RUP*. Ce sujet d�passe -cependant le cadre de ce livre. +dans toutes les m�thodologies existantes, comme le RUP (IBM Rational Unified +Process). Ce sujet d�passe cependant le cadre de la recette. \section*{Cr��r le code} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2608 - cookbook/trunk
Author: tziade Date: Sun Mar 12 02:28:20 2006 New Revision: 2608 Modified: cookbook/trunk/cookbook.en.kilepr cookbook/trunk/cookbook.fr.kilepr Log: changing kilepr files consequently Modified: cookbook/trunk/cookbook.en.kilepr == --- cookbook/trunk/cookbook.en.kilepr (original) +++ cookbook/trunk/cookbook.en.kilepr Sun Mar 12 02:28:20 2006 @@ -21,7 +21,15 @@ line=0 open=false -[item:recipe0.en.tex] +[item:recipe00.en.tex] +archive=true +column=0 +encoding=UTF-8 +highlight=LaTeX +line=0 +open=true + +[item:recipe07.en.tex] archive=true column=0 encoding=UTF-8 @@ -60,11 +68,3 @@ highlight= line=0 open=false - -[item:recipe7.en.tex] -archive=true -column=0 -encoding=UTF-8 -highlight=LaTeX -line=0 -open=true Modified: cookbook/trunk/cookbook.fr.kilepr == --- cookbook/trunk/cookbook.fr.kilepr (original) +++ cookbook/trunk/cookbook.fr.kilepr Sun Mar 12 02:28:20 2006 @@ -1,7 +1,7 @@ [General] img_extIsRegExp=false img_extensions=.eps .pdf .dvi .ps .fig .gif .jpg .jpeg .png -lastDocument=file:///home/svn.z3lab.org/cookbook/recipe7.fr.tex +lastDocument=file:///home/svn.z3lab.org/cookbook/recipe48.fr.tex masterDocument= name=Zope 3 Cookbook, Français pkg_extIsRegExp=false @@ -21,7 +21,7 @@ line=7 open=false -[item:recipe0.fr.tex] +[item:recipe00.fr.tex] archive=true column=0 encoding=ISO 8859-15 @@ -29,12 +29,20 @@ line=0 open=true +[item:recipe07.fr.tex] +archive=true +column=27 +encoding=ISO 8859-15 +highlight=LaTeX +line=107 +open=true + [item:recipe48.fr.tex] archive=true -column=16 +column=30 encoding=ISO 8859-15 highlight=LaTeX -line=8 +line=27 open=true [item:recipe49.fr.tex] @@ -47,24 +55,16 @@ [item:recipe50.fr.tex] archive=true -column=14 +column=77 encoding=ISO 8859-15 highlight=LaTeX -line=14 +line=168 open=true [item:recipe51.fr.tex] archive=true -column=0 -encoding=ISO 8859-15 -highlight=LaTeX -line=0 -open=true - -[item:recipe7.fr.tex] -archive=true -column=0 +column=13 encoding=ISO 8859-15 highlight=LaTeX -line=0 +line=20 open=true -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2609 - cookbook/trunk
Author: tziade Date: Sun Mar 12 03:00:07 2006 New Revision: 2609 Modified: cookbook/trunk/recipe48.fr.tex Log: removed franglish word Modified: cookbook/trunk/recipe48.fr.tex == --- cookbook/trunk/recipe48.fr.tex (original) +++ cookbook/trunk/recipe48.fr.tex Sun Mar 12 03:00:07 2006 @@ -104,7 +104,7 @@ Pour les liens, les deux types les plus courants sont les liens complets vers des ressources web (URL), et les liens vers une autre partie du document. -Les URL peuvent �tre associ�s � un texte mis entre simple quotes, et suivit +Les URL peuvent �tre associ�s � un texte mis entre simple c�tes, et suivit d'un espace soulign�. Ce texte est ensuite r�p�t� en bas de document, pr�c�d� de deux points, un espace , puis un espace soulign�, puis de l'url pr�c�d� du symbole :. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2571 - cookbook/trunk
Author: tziade Date: Fri Mar 10 18:05:25 2006 New Revision: 2571 Added: cookbook/trunk/recipe48.fr.tex cookbook/trunk/recipe49.fr.tex cookbook/trunk/recipe50.fr.tex cookbook/trunk/recipe51.fr.tex cookbook/trunk/tests.txt (contents, props changed) cookbook/trunk/textest.py (contents, props changed) Modified: cookbook/trunk/macros.tex cookbook/trunk/recipe7.fr.tex cookbook/trunk/recipe_list.txt cookbook/trunk/tests.py Log: save point 'veauville' commit, before i forget Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Fri Mar 10 18:05:25 2006 @@ -12,8 +12,10 @@ \newenvironment{problem} { +\emph{\large{Probl�me}} +\begin{quote} } -{} +{\end{quote}} \newenvironment{solution} { @@ -25,3 +27,28 @@ \newcommand{\translator}[1]{ } + +\newcommand{\reviewer}[1]{ +} + + +\newcommand{\code}[1]{ +\url{#1} +} + +\newcommand{\codetitle}[1] { +\vspace{4pt} +\noindent\emph{\underline{#1}} +} + +\newenvironment{codenotes} +{\hrule +\begin{list}{$\triangleright$}{\setlength{\leftmargin}{1em}} +} +{\end{list}} + +\newcommand{\comment}[1]{ +\begin{comment} +#1 +\end{comment} +} Added: cookbook/trunk/recipe48.fr.tex == --- (empty file) +++ cookbook/trunk/recipe48.fr.tex Fri Mar 10 18:05:25 2006 @@ -0,0 +1,105 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Ecrire du reSTructuredText pour la documentation et les doctests} + +\begin{problem} +L'ensemble de la documentation des paquets de Zope est r�alis�e au format +reSTructuredText, ou reST, qui est une �volution du StructuredText. Ce format +fourni une structure simple, qui n'alourdit pas le texte, contrairement � +LaTeX, et peut �tre lu directement. Des outils permettent ensuite de manipuler +ce contenu pour le transformer en HTML, LaTeX, XML ou PDF. + +Cette recette est une \textit{cheatsheet} minimale, qui permet d'�crire des +doctests destin�s � des paquets Zope. +\end{problem} + +\begin{solution} +\section*{Structurer le fichier} +Pour organiser un fichier en section, sous-section, sous-sous-section, etc., +il suffit de souligner le titre de la section avec un caract�re dans l'ensemble: +\code{\/-=} ** a v�rifier **. A chaque section, si un nouveau caract�re est +utilis�, reST l'associe au niveau donn� pour le reste du document. + +\codetitle{Exemple de structure reST:} +\begin{verbatim} +Titre += + +Ok, donc j'ai deux sections. Profitez-en. + +Section 1 +~ + +Le titre est un frimeur. j'en parle dans une sous-section. + +Sous-Section 1 +-- + +Je suis charg� par ma section de casser du sucre sur le dos +de Titre, mais je n'en ferais rien, je vise une promotion. + +Section 2 +~ + +Calmons nous, le document est fini de toute mani�re... +\end{verbatim} + +\section*{Ins�rer des exemples de code} + +Ins�rer du code se fait en l'indentant d'au minimum 1 caract�re (en g�n�ral 2 +ou 4). Ce bloc doit �tre pr�c�d� du signe :: et d'une ligne vide, puis +suivi d'une ligne vide. + +\codetitle{Insertion de code:} +\begin{verbatim} +Le module Math +== + +Python dispose d'un module math, qui fourni une fonction pour les puissances:: + + import math + math.pow(56, 3) + 175616.0 + +Il y a aussi pi:: + + math.pi + 3.1415926535897931 +\end{verbatim} +\begin{codenotes} +\item Zope 3 indente de deux caract�res, mais certains d�veloppeurs pr�f�rent +une indentation sur 4 caract�res, peut �tre pour �diter plus facilement +ces fichiers dans leur �diteur de code Python. +\end{codenotes} + +\section*{Ins�rer des liens et formatter le texte} + +\noindent reST permet aussi d'afficher du texte en italique, en gras. + +\codetitle{Gras et italique:} +\begin{verbatim} +Recette +=== + +Il n'y a absolument pas de **gras** dans les plats `italiens`. +\end{verbatim} + +\noindent La notation italique est utilis�e pour mettre en exergue un module +ou tout �l�ment de code dans le texte. La notation grasse est r�serv�e � la +mise en valeur de mots du texte. + +Pour les liens, AFINIR + +\section*{Bonnes pratiques en vrac} + +AFINIR + +\end{solution} + +\end{document} Added: cookbook/trunk/recipe49.fr.tex == --- (empty file) +++ cookbook/trunk/recipe49.fr.tex Fri Mar 10 18:05:25 2006 @@ -0,0 +1,21 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Utiliser zapi dans les tests} + +\begin{problem} +TODO +\end{problem} + +\begin{solution} +TODO +\end{solution} + +\end{document} + + Added: cookbook/trunk/recipe50.fr.tex == --- (empty file) +++ cookbook/trunk/recipe50
[Z3lab-checkins] r2530 - cookbook/trunk
Author: tziade Date: Sun Mar 5 17:42:40 2006 New Revision: 2530 Modified: cookbook/trunk/recipe_list.txt Log: numberings Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Sun Mar 5 17:42:40 2006 @@ -22,57 +22,57 @@ Using Zope ~~ -- zope installation -- understanding runzope, zopectl, and other things -- understanding the interface +01 - zope installation +02 - understanding runzope, zopectl, and other things +03 - understanding the interface Developping Zope - the concepts ~~~ -- the zope component architecture -- understanding the development process -- writing unit tests -- writing functional tests -- debugging the code -- understanding Interfaces -- understanding the traversal -- mastering ZCML -- mastering ZPT -- adding an extension package -- creating and publishing an object -- creating resources -- creating a global utility -- creating a local utility -- understanding Adapters -- creating an Adapter -- understanding forms -- creating a object with forms -- understanding Events -- using Events +04 - the zope component architecture +05 - understanding the development process +06 - writing unit tests +07 - writing functional tests +08 - debugging the code +09 - understanding Interfaces +10 - understanding the traversal +11 - mastering ZCML +12 - mastering ZPT +13 - adding an extension package +14 - creating and publishing an object +15 - creating resources +16 - creating a global utility +17 - creating a local utility +18 - understanding Adapters +19 - creating an Adapter +20 - understanding forms +21 - creating a object with forms +22 - understanding Events +23 - using Events - ... Developping Zope - real-world recipes ~ -- setting up authentication -- designing a publication workflow -- working with metadata (annotations) -- creating a new skin -- driving the application with XML-RPC -- creating an internationalized package -- creating multilanguage content objects -- changing and migrating existing objects +40 - setting up authentication +41 - designing a publication workflow +42 - working with metadata (annotations) +43 - creating a new skin +44 - driving the application with XML-RPC +45 - creating an internationalized package +46 - creating multilanguage content objects +47 - changing and migrating existing objects - ... Developping Zope - advanced recipes ~~~ -- extending ZCML -- extending ZPT -- implementing a new publisher +60 - extending ZCML +61 - extending ZPT +62 - implementing a new publisher - ... Administrating Zope ~~~ -- setting up zope with apache -- setting up zope with squid +80 - setting up zope with apache +81 - setting up zope with squid - ... -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2531 - cookbook/trunk
Author: tziade Date: Sun Mar 5 17:56:06 2006 New Revision: 2531 Modified: cookbook/trunk/macros.tex Log: added a few commands Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Sun Mar 5 17:56:06 2006 @@ -37,3 +37,10 @@ \newcommand{\status}[1]{ } + +\newcommand{\author}[1]{ +} + + +\newcommand{\translator}[1]{ +} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2536 - cookbook/trunk
Author: tziade Date: Mon Mar 6 00:19:37 2006 New Revision: 2536 Modified: cookbook/trunk/recipe0.en.tex cookbook/trunk/recipe0.fr.tex Log: using * for chapters Modified: cookbook/trunk/recipe0.en.tex == --- cookbook/trunk/recipe0.en.tex (original) +++ cookbook/trunk/recipe0.en.tex Mon Mar 6 00:19:37 2006 @@ -5,7 +5,7 @@ \begin{document} -\chapter{Dummy Recipe} +\chapter*{Dummy Recipe} \begin{problem} This dummy recipe is a tutorial on how to write a recipe. Modified: cookbook/trunk/recipe0.fr.tex == --- cookbook/trunk/recipe0.fr.tex (original) +++ cookbook/trunk/recipe0.fr.tex Mon Mar 6 00:19:37 2006 @@ -5,7 +5,7 @@ \begin{document} -\chapter{Recette de test} +\chapter*{Recette de test} \begin{problem} Cette recette est un exemple. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2537 - cookbook/trunk
Author: tziade Date: Mon Mar 6 00:20:02 2006 New Revision: 2537 Added: cookbook/trunk/recipe7.fr.tex Log: adding r7-fr Added: cookbook/trunk/recipe7.fr.tex == --- (empty file) +++ cookbook/trunk/recipe7.fr.tex Mon Mar 6 00:20:02 2006 @@ -0,0 +1,45 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} +\author{Tarek Ziad�} + +\begin{document} + +\chapter*{Ecrire des tests fonctionnels} + +\begin{problem} +Les tests fonctionnels, ou acceptance tests, sont compl�mentaires aux +tests unitaires: ce sont des bo�tes noires qui testent les fonctionnalit�s +du syst�me complet, conform�ment � chaque besoin �nonc� par le commanditaire. + +Ces tests ne se concentrent que sur l'utilisation du syst�me, comme le ferait +un utilisateur lambda, pour s'assurer que les fonctionnalit�s attendues sont +pr�sentes et fonctionnent. + +Ils deviennent �galement un t�moin de qualit� in�galable pour le commanditaire, +qui peut parfois �crire ou �tendre lui-m�me ces tests. + +Pour les applications web, ces tests n�cessitent un environnement d'ex�cution +particulier, qui imite au mieux un naviguateur. C'est l'objectif du paquet +`zope.testbrowser`, qui fourni des outils pour �crire des tests fonctionnels +bas�s sur des �changes avec un naviguateur simul�. +\end{problem} + +\begin{solution} + +\section*{Principes et fonctionnement de testbrowser} + +todo + +\section*{Simuler une session utilisateur} + +todo + +\section*{Limitations de testbrowser} + +todo + +\end{solution} + +\end{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2538 - cookbook/trunk
Author: tziade Date: Mon Mar 6 02:31:58 2006 New Revision: 2538 Added: cookbook/trunk/tests.py (contents, props changed) Log: adding test script Added: cookbook/trunk/tests.py == --- (empty file) +++ cookbook/trunk/tests.py Mon Mar 6 02:31:58 2006 @@ -0,0 +1,40 @@ +import doctest +import os +import unittest +import re + + +extracter = r'\\begin{Verbatim}(?Pcontents.*)\\end{Verbatim}' +cExtracter = re.compile(extracter, re.MULTILINE| re.DOTALL) + +current_folder = os.path.dirname(__file__) +if current_folder == '': +current_folder = '.' + + +def test_suite(): +options = doctest.ELLIPSIS +extractor = doctest.DocTestParser() +tests = [] + +for file in os.listdir(current_folder): +if not file.endswith('.tex'): +continue + +content = open('%s/%s' % (current_folder, file)).read() +match_obj = cExtracter.search(content) +if match_obj is None: +continue + +content = match_obj.group('contents').strip() + +file_tests = extractor.get_doctest(content, globals(), file, file, + None) + +tests.append(doctest.DocFileCase(file_tests)) + +return unittest.TestSuite(tests) + +if __name__ == '__main__': +import unittest +unittest.main(defaultTest='test_suite') -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2539 - cookbook/trunk
Author: tziade Date: Mon Mar 6 02:33:32 2006 New Revision: 2539 Modified: cookbook/trunk/tests.py Log: grabbing the smallest bloxk Modified: cookbook/trunk/tests.py == --- cookbook/trunk/tests.py (original) +++ cookbook/trunk/tests.py Mon Mar 6 02:33:32 2006 @@ -4,7 +4,7 @@ import re -extracter = r'\\begin{Verbatim}(?Pcontents.*)\\end{Verbatim}' +extracter = r'\\begin{Verbatim}(?Pcontents.*?)\\end{Verbatim}' cExtracter = re.compile(extracter, re.MULTILINE| re.DOTALL) current_folder = os.path.dirname(__file__) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2540 - cookbook/trunk
Author: tziade Date: Mon Mar 6 03:00:53 2006 New Revision: 2540 Added: cookbook/trunk/__init__.py (contents, props changed) Log: make it a package Added: cookbook/trunk/__init__.py == --- (empty file) +++ cookbook/trunk/__init__.py Mon Mar 6 03:00:53 2006 @@ -0,0 +1 @@ +# package -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2527 - cookbook/trunk
Author: tziade Date: Sun Mar 5 02:17:13 2006 New Revision: 2527 Modified: cookbook/trunk/recipe_list.txt Log: upd Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Sun Mar 5 02:17:13 2006 @@ -5,9 +5,10 @@ == - Using Zope -- Developping Zope +- Developping Zope - the concepts +- Developping Zope - real-world recipes +- Developping Zope - advanced recipes - Administrating Zope -- Integrating Zope Levels == @@ -25,8 +26,8 @@ - understanding runzope, zopectl, and other things - understanding the interface -Developping Zope - +Developping Zope - the concepts +~~~ - the zope component architecture - understanding the development process @@ -34,10 +35,10 @@ - writing functional tests - debugging the code - understanding Interfaces -- understanding traversal +- understanding the traversal - mastering ZCML -- adding an extension package - mastering ZPT +- adding an extension package - creating and publishing an object - creating resources - creating a global utility @@ -47,18 +48,31 @@ - understanding forms - creating a object with forms - understanding Events -- using events -- creating internationalized interfaces +- using Events +- ... + +Developping Zope - real-world recipes +~ +- setting up authentication +- designing a publication workflow +- working with metadata (annotations) +- creating a new skin +- driving the application with XML-RPC +- creating an internationalized package - creating multilanguage content objects +- changing and migrating existing objects +- ... + +Developping Zope - advanced recipes +~~~ +- extending ZCML +- extending ZPT +- implementing a new publisher +- ... Administrating Zope ~~~ - setting up zope with apache - setting up zope with squid - -Integrating Zope - - -- implementing and using xml-rpc views -- implementing a new publisher +- ... -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2516 - cookbook/trunk
Author: tziade Date: Fri Mar 3 01:21:30 2006 New Revision: 2516 Modified: cookbook/trunk/macros.tex cookbook/trunk/recipe0.en.tex Log: simpler layout Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Fri Mar 3 01:21:30 2006 @@ -5,87 +5,20 @@ \usepackage{graphicx} \usepackage{fancyvrb} \usepackage[obeyspaces]{url} -\usepackage{listings} \usepackage{nameref} \usepackage[usenames]{color} +\usepackage{listings} % Setup up listings. -\lstnewenvironment{python} -{ -\lstset{language=Python, -fancyvrb=true, -morekeywords={self}, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -stringstyle=\ttfamily\color{Blue}, -keywordstyle=\color{BlueViolet}\bfseries, -commentstyle=\color{BrickRed}\itshape, -showstringspaces=false} -}{} - -\lstnewenvironment{codetext} -{ -\lstset{language=Python, -fancyvrb=true, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -showstringspaces=false} -}{} - -\lstnewenvironment{zcml} -{ -\lstset{language=XML, -fancyvrb=true, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -stringstyle=\ttfamily\color{Blue}, -keywordstyle=\color{BlueViolet}\bfseries, -commentstyle=\color{BrickRed}\itshape, -showstringspaces=false} -}{} - -\lstnewenvironment{xml} +\newenvironment{python} { -\lstset{language=XML, -fancyvrb=true, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -stringstyle=\ttfamily\color{Blue}, -keywordstyle=\color{BlueViolet}\bfseries, -commentstyle=\color{BrickRed}\itshape, -showstringspaces=false} -}{} - -\lstnewenvironment{zpt} -{ -\lstset{language=XML, -fancyvrb=true, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -stringstyle=\ttfamily\color{Blue}, -keywordstyle=\color{BlueViolet}\bfseries, -commentstyle=\color{BrickRed}\itshape, -showstringspaces=false} -}{} - -\lstnewenvironment{css} -{ -\lstset{fancyvrb=true, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -stringstyle=\ttfamily\color{Blue}, -keywordstyle=\color{BlueViolet}\bfseries, -commentstyle=\color{BrickRed}\itshape, -showstringspaces=false} -}{} +} +{} -\lstnewenvironment{shell} +\newenvironment{code} { -\lstset{fancyvrb=true, -basicstyle=\footnotesize\ttfamily, -basewidth=0.51em, -showstringspaces=false} -}{} +} +{} % Problem/Task Modified: cookbook/trunk/recipe0.en.tex == --- cookbook/trunk/recipe0.en.tex (original) +++ cookbook/trunk/recipe0.en.tex Fri Mar 3 01:21:30 2006 @@ -29,67 +29,41 @@ \section*{Specific commands for the code blocs} -You can define special sections to present Python, ZPT, XML, CSS, -and ZCML examples. They are all defined in macros.tex. They help -you write examples. - -\subsection*{Python} - -\begin{python} - import math - math.pow(2, 4) -16.0 -\end{python} - -\subsection*{Codetext} - -\begin{codetext} - import math - math.pow(2, 4) -16.0 -\end{codetext} - - -The only difference between Codetext and Python is that Python blocs are -executed for real. - -\subsection*{ZCML} -\begin{zcml} -page - for=IMyInterface - name=mypage.html - permission=the.permission - layer=the_layer - class=MyClass - template=my_template.pt / -\end{zcml} - -\subsection*{XML or HTML} -\begin{xml} -PERSONS - PERSON -NAMEJohn/NAME - /PERSON -/PERSONS -\end{xml} - -\subsection*{CSS} -\begin{css} -.style { - background: 1px; - color: red; -} -\end{css} - -\subsection*{Shell} -\begin{shell} -[EMAIL PROTECTED]:/home/svn.z3lab.org/cookbook\$ ls -lh -total 72K --rw-r--r-- 1 tziade tziade 647 2006-02-25 23:30 cookbookmacros.aux --rw-r--r-- 1 tziade tziade 2,9K 2006-02-25 23:30 cookbookmacros.tex --rw-r--r-- 1 tziade tziade 158 2006-02-25 23:30 recipe1.aux --rw-r--r-- 1 tziade tziade 1,2K 2006-02-25 23:30 recipe1.tex -\end{shell} +You can define special sections to present a code bloc. Either use verbatim +to define code or Verbatim to define code that will be run by the tests. + +verbatim: +\begin{verbatim} + import math + math.pow(2, 4) +16.0 + +page +for=IMyInterface +name=mypage.html +permission=the.permission +layer=the_layer +class=MyClass +template=my_template.pt / + +PERSONS +PERSON +NAMEJohn/NAME +/PERSON +/PERSONS + +.style { +background: 1px; +color: red; +} +\end{verbatim} + +Verbatim: +\begin{Verbatim} + import math + math.pow(2, 4) +16.0 +\end{Verbatim} \section*{About latex} @@ -97,10 +71,6 @@ \url{http
[Z3lab-checkins] r2517 - cookbook/trunk
Author: tziade Date: Fri Mar 3 01:29:23 2006 New Revision: 2517 Added: cookbook/trunk/recipe0.fr.tex Log: added fr version to try a multilingual autosync Added: cookbook/trunk/recipe0.fr.tex == --- (empty file) +++ cookbook/trunk/recipe0.fr.tex Fri Mar 3 01:29:23 2006 @@ -0,0 +1,75 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} +\status{draft} + +\begin{document} + +\chapter{Recette de test} + +\begin{problem} +Cette recette est un exemple. +\end{problem} + +\begin{solution} + +\section*{Structure des recettes} + +Une recette est compos�e de deux sections: 'problem' et 'solution'. + +\begin{itemize} +\item La section problem d�crit en 20 lignes le probl�me que la recette r�soud. + +\item La section solution est form�e de 'sections' et 'subsections', et fourni +la solution. +\end{itemize} + +La solution peut contenir du texte et du code. Le code peut �tre d�fini de deux mani�res? + +\section*{Sections pour le code} + +Le code est d�fini en verbatim ou Verbatim. La seule diff�rence est que le Verbatim +est ex�cut� par l'outil de test. + +verbatim: +\begin{verbatim} + import math + math.pow(2, 4) +16.0 + +page +for=IMyInterface +name=mypage.html +permission=the.permission +layer=the_layer +class=MyClass +template=my_template.pt / + +PERSONS +PERSON +NAMEJohn/NAME +/PERSON +/PERSONS + +.style { +background: 1px; +color: red; +} +\end{verbatim} + +Verbatim: +\begin{Verbatim} + import math + math.pow(2, 4) +16.0 +\end{Verbatim} + +\section*{A propos de Latex} + +Plus d'infos sur Latex, sur la FAQ anglaise: + + \url{http://www.tex.ac.uk/cgi-bin/texfaq2html} + +\end{solution} + +\end{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins