[Checkins] SVN: grok/trunk/ Merge philikon-eggs2 branch. Grok is fully on eggs now.

Philipp von Weitershausen philikon at philikon.de
Thu Jul 12 09:45:23 EDT 2007


Log message for revision 77736:
  Merge philikon-eggs2 branch.  Grok is fully on eggs now.
  

Changed:
  U   grok/trunk/buildout.cfg
  U   grok/trunk/doc/groktut/INSTALL.txt
  U   grok/trunk/doc/groktut/a_second_view/buildout.cfg
  U   grok/trunk/doc/groktut/a_second_view/setup.py
  U   grok/trunk/doc/groktut/a_second_view/src/sample/configure.zcml
  U   grok/trunk/doc/groktut/an_empty_grok_project/buildout.cfg
  U   grok/trunk/doc/groktut/an_empty_grok_project/setup.py
  U   grok/trunk/doc/groktut/an_empty_grok_project/src/sample/configure.zcml
  U   grok/trunk/doc/groktut/buildout_tut.cfg
  D   grok/trunk/doc/groktut/empty/
  U   grok/trunk/doc/groktut/publishing_a_simple_web_page/buildout.cfg
  U   grok/trunk/doc/groktut/publishing_a_simple_web_page/setup.py
  U   grok/trunk/doc/groktut/publishing_a_simple_web_page/src/sample/configure.zcml
  U   grok/trunk/doc/tutorial.txt
  U   grok/trunk/grokwiki/setup.py
  U   grok/trunk/grokwiki/src/grokwiki/configure.zcml
  U   grok/trunk/setup.py
  U   grok/trunk/src/grok/configure.zcml
  A   grok/trunk/src/grok/ftesting.zcml
  U   grok/trunk/src/grok/ftests/test_grok_functional.py

-=-
Modified: grok/trunk/buildout.cfg
===================================================================
--- grok/trunk/buildout.cfg	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/buildout.cfg	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1,61 +1,58 @@
 [buildout]
 develop = . grokwiki ldapaddressbook
-parts = zope3 data instance testdata testinstance test
+parts = grokwiki instance data test
+find-links = http://download.zope.org/distribution/
 
 [zope3]
-recipe = zc.recipe.zope3checkout
-url = svn://svn.zope.org/repos/main/Zope3/branches/3.3
+# this dead chicken is needed by some other recipe(s)
+location =
 
-[data]
-recipe = zc.recipe.filestorage
+[grokwiki]
+recipe = zc.zope3recipes:app
+eggs = grokwiki
+site.zcml = <include package="grokwiki" />
+            <include package="zope.app.twisted" />
 
-[testdata]
-recipe = zc.recipe.filestorage
+            <securityPolicy 
+                component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
 
-[testinstance]
-recipe = zc.recipe.zope3instance
-database = testdata
-user = grok:grok
-eggs = setuptools
-       grok
-zcml = zope.annotation
-       zope.copypastemove
-       zope.formlib
-       zope.i18n-meta
-       zope.i18n.locales
-       zope.publisher
-       zope.security-meta
-       zope.size
-       zope.traversing
-       zope.traversing.browser
-       zope.app    
-       zope.app-meta
-       zope.app.securitypolicy
-       zope.app.securitypolicy-meta
-       zope.app.authentication
-       zope.app.catalog
-       zope.app.intid
-       zope.app.keyreference
-       grok
-       grok-meta
+            <unauthenticatedPrincipal id="zope.anybody"
+                                      title="Unauthenticated User" />
+            <unauthenticatedGroup id="zope.Anybody"
+                                  title="Unauthenticated Users" />
+            <authenticatedGroup id="zope.Authenticated"
+                                title="Authenticated Users" />
+            <everybodyGroup id="zope.Everybody"
+                            title="All Users" />
+            <principal id="zope.manager"
+                       title="Manager"
+                       login="grok"
+                       password_manager="Plain Text"
+                       password="grok"
+                       />
 
-[instance]
-recipe = zc.recipe.zope3instance
-database = data
-user = grok:grok
-eggs = setuptools
-       grok
-       grokwiki
+            <!-- Replace the following directive if you don't want
+                 public access -->
+            <grant permission="zope.View"
+                   principal="zope.Anybody" />
+            <grant permission="zope.app.dublincore.view"
+                   principal="zope.Anybody" />
 
-zcml = ${testinstance:zcml}
-       zope.app.twisted
-       grokwiki
+            <role id="zope.Manager" title="Site Manager" />
+            <role id="zope.Member" title="Site Member" />
+            <grantAll role="zope.Manager" />
+            <grant role="zope.Manager"
+                   principal="zope.manager" />
 
+[data]
+recipe = zc.recipe.filestorage
+
+[instance]
+recipe = zc.zope3recipes:instance
+application = grokwiki
+zope.conf = ${data:zconfig}
+
 [test]
 recipe = zc.recipe.testrunner
 eggs = grok
-extra-paths = parts/zope3/src
-working-directory = parts/testinstance
-defaults = ['--tests-pattern', '^f?tests$',
-            '-v'
-           ]
+defaults = ['--tests-pattern', '^f?tests$', '-v']

Modified: grok/trunk/doc/groktut/INSTALL.txt
===================================================================
--- grok/trunk/doc/groktut/INSTALL.txt	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/INSTALL.txt	2007-07-12 13:45:23 UTC (rev 77736)
@@ -9,43 +9,18 @@
 
 This will download and install buildout. It will create various
 directories, only one of which, ``eggs``, is important. This directory
-contains all Python eggs shared by the tutorial samples.
+contains all Python eggs shared by the tutorial samples.  If you
+already have a directory for sharing eggs with other buildouts, you
+can edit ``buildout_tut.cfg`` and change the ``eggs-directory`` option
+to point to this directory, e.g.::
 
-Then, we need to install Zope 3 and point the tutorial samples to it.
-First, download Zope 3. We will be showing some Unix style
-instructions here - Windows users should download and run the Zope 3
-installer instead. Go to your preferred installation directory (or
-stay in ``groktut``)::
+  [buildout]
+  eggs-directory = /home/me/shared-eggs
 
-  $ wget http://www.zope.org/Products/Zope3/3.3.1/Zope-3.3.1.tgz
-  $ tar xvzf Zope-3.3.1.tgz
-  $ cd Zope-3.3.1
+Now go to the tutorial sample you'd like to look at and launch
+buildout::
 
-We need to tell Zope 3 in which directory it should install itself
-(using ``--prefix``)::
-
-  $ ./configure --prefix=/path/to/zope331
-
-We now make and install it::
-
-  $ make
-  $ make install
-
-Make a note of the Zope 3 installation directory (you too, Windows
-user).
-
-Go back to the ``groktut`` directory and edit the ``buildout_tut.cfg``
-file. Change the ``location`` line to point to your Zope 3
-installation::
-
-  [zope3]
-  # change this to the path to an installed Zope 3 installation
-  location = /path/to/zope331
-
-Now go to the tutorial sample you'd like to look at::
-
   $ cd an_empty_grok_project
-
   $ ../buildout -N
 
 The -N option tells the buildout_ system not to look for newer files
@@ -59,7 +34,7 @@
 tutorial directory you run the buildout script. From the specific
 tutorial directory, you can start up Zope like this::
 
-  $ parts/instance/bin/zopectl fg
+  $ bin/instance fg
 
 Zope should then be running on port 8080 (http://localhost:8080).
 

Modified: grok/trunk/doc/groktut/a_second_view/buildout.cfg
===================================================================
--- grok/trunk/doc/groktut/a_second_view/buildout.cfg	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/a_second_view/buildout.cfg	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1,3 +1,3 @@
 [buildout]
-develop = .
+develop = . ../../..
 extends = ../buildout_tut.cfg
\ No newline at end of file

Modified: grok/trunk/doc/groktut/a_second_view/setup.py
===================================================================
--- grok/trunk/doc/groktut/a_second_view/setup.py	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/a_second_view/setup.py	2007-07-12 13:45:23 UTC (rev 77736)
@@ -20,9 +20,9 @@
       zip_safe=False,
       install_requires=['setuptools',
                         'grok',
-                        # -*- Extra requirements: -*-
+                        # Add extra requirements here
                         ],
       entry_points="""
-      # -*- Entry points: -*-
+      # Add entry points here
       """,
       )

Modified: grok/trunk/doc/groktut/a_second_view/src/sample/configure.zcml
===================================================================
--- grok/trunk/doc/groktut/a_second_view/src/sample/configure.zcml	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/a_second_view/src/sample/configure.zcml	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1 +1,5 @@
-<grok package="." xmlns="http://namespaces.zope.org/grok" />
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:grok="http://namespaces.zope.org/grok">
+  <include package="grok" />
+  <grok:grok package="." />
+</configure>

Modified: grok/trunk/doc/groktut/an_empty_grok_project/buildout.cfg
===================================================================
--- grok/trunk/doc/groktut/an_empty_grok_project/buildout.cfg	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/an_empty_grok_project/buildout.cfg	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1,3 +1,3 @@
 [buildout]
-develop = .
+develop = . ../../..
 extends = ../buildout_tut.cfg
\ No newline at end of file

Modified: grok/trunk/doc/groktut/an_empty_grok_project/setup.py
===================================================================
--- grok/trunk/doc/groktut/an_empty_grok_project/setup.py	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/an_empty_grok_project/setup.py	2007-07-12 13:45:23 UTC (rev 77736)
@@ -20,9 +20,9 @@
       zip_safe=False,
       install_requires=['setuptools',
                         'grok',
-                        # -*- Extra requirements: -*-
+                        # Add extra requirements here
                         ],
       entry_points="""
-      # -*- Entry points: -*-
+      # Add entry points here
       """,
       )

Modified: grok/trunk/doc/groktut/an_empty_grok_project/src/sample/configure.zcml
===================================================================
--- grok/trunk/doc/groktut/an_empty_grok_project/src/sample/configure.zcml	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/an_empty_grok_project/src/sample/configure.zcml	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1 +1,5 @@
-<grok package="." xmlns="http://namespaces.zope.org/grok" />
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:grok="http://namespaces.zope.org/grok">
+  <include package="grok" />
+  <grok:grok package="." />
+</configure>

Modified: grok/trunk/doc/groktut/buildout_tut.cfg
===================================================================
--- grok/trunk/doc/groktut/buildout_tut.cfg	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/buildout_tut.cfg	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1,50 +1,58 @@
 [buildout]
-parts = data instance test
+parts = data app instance test
 eggs-directory = ../eggs
+find-links = http://download.zope.org/distribution/
 
 [zope3]
-# change this to the path to an installed Zope 3 installation
-location = /path/to/zope331
+# this dead chicken is needed by some other recipe(s)
+location =
 
 [data]
 recipe = zc.recipe.filestorage
 
+[app]
+recipe = zc.zope3recipes:app
+eggs = sample
+site.zcml = <include package="sample" />
+            <include package="zope.app.twisted" />
+
+            <securityPolicy 
+                component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+            <unauthenticatedPrincipal id="zope.anybody"
+                                      title="Unauthenticated User" />
+            <unauthenticatedGroup id="zope.Anybody"
+                                  title="Unauthenticated Users" />
+            <authenticatedGroup id="zope.Authenticated"
+                                title="Authenticated Users" />
+            <everybodyGroup id="zope.Everybody"
+                            title="All Users" />
+            <principal id="zope.manager"
+                       title="Manager"
+                       login="grok"
+                       password_manager="Plain Text"
+                       password="grok"
+                       />
+
+            <!-- Replace the following directive if you don't want
+                 public access -->
+            <grant permission="zope.View"
+                   principal="zope.Anybody" />
+            <grant permission="zope.app.dublincore.view"
+                   principal="zope.Anybody" />
+
+            <role id="zope.Manager" title="Site Manager" />
+            <role id="zope.Member" title="Site Member" />
+            <grantAll role="zope.Manager" />
+            <grant role="zope.Manager"
+                   principal="zope.manager" />
+
 [instance]
-recipe = zc.recipe.zope3instance
-database = data
-user = grok:grok
-eggs = setuptools
-       grok
-       sample
+recipe = zc.zope3recipes:instance
+application = app
+zope.conf = ${data:zconfig}
 
-zcml = zope.annotation
-       zope.copypastemove
-       zope.formlib
-       zope.i18n-meta
-       zope.i18n.locales
-       zope.publisher
-       zope.security-meta
-       zope.size
-       zope.traversing
-       zope.traversing.browser
-       zope.app    
-       zope.app-meta
-       zope.app.securitypolicy
-       zope.app.securitypolicy-meta
-       zope.app.authentication
-       zope.app.catalog
-       zope.app.intid
-       zope.app.keyreference
-       zope.app.twisted
-       grok
-       grok-meta
-       sample
-
 [test]
 recipe = zc.recipe.testrunner
 eggs = sample
-extra-paths = parts/zope3/src
-working-directory = parts/instance
-defaults = ['--tests-pattern', '^f?tests$',
-            '-v'
-           ]
+defaults = ['--tests-pattern', '^f?tests$', '-v']

Modified: grok/trunk/doc/groktut/publishing_a_simple_web_page/buildout.cfg
===================================================================
--- grok/trunk/doc/groktut/publishing_a_simple_web_page/buildout.cfg	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/publishing_a_simple_web_page/buildout.cfg	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1,3 +1,3 @@
 [buildout]
-develop = .
+develop = . ../../..
 extends = ../buildout_tut.cfg
\ No newline at end of file

Modified: grok/trunk/doc/groktut/publishing_a_simple_web_page/setup.py
===================================================================
--- grok/trunk/doc/groktut/publishing_a_simple_web_page/setup.py	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/publishing_a_simple_web_page/setup.py	2007-07-12 13:45:23 UTC (rev 77736)
@@ -20,9 +20,9 @@
       zip_safe=False,
       install_requires=['setuptools',
                         'grok',
-                        # -*- Extra requirements: -*-
+                        # Add extra requirements here
                         ],
       entry_points="""
-      # -*- Entry points: -*-
+      # Add entry points here
       """,
       )

Modified: grok/trunk/doc/groktut/publishing_a_simple_web_page/src/sample/configure.zcml
===================================================================
--- grok/trunk/doc/groktut/publishing_a_simple_web_page/src/sample/configure.zcml	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/groktut/publishing_a_simple_web_page/src/sample/configure.zcml	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1 +1,5 @@
-<grok package="." xmlns="http://namespaces.zope.org/grok" />
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:grok="http://namespaces.zope.org/grok">
+  <include package="grok" />
+  <grok:grok package="." />
+</configure>

Modified: grok/trunk/doc/tutorial.txt
===================================================================
--- grok/trunk/doc/tutorial.txt	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/doc/tutorial.txt	2007-07-12 13:45:23 UTC (rev 77736)
@@ -118,11 +118,10 @@
 
 This tells grokproject to create a new subdirectory called ``Sample``
 and set up the project in there. grokproject will automatically
-download and install Zope 3 and Grok into the project area.  If you
-already have Zope 3.3.x installed, you can save some time and tell
-grokproject to reuse that installation:
+download and install Zope 3 and Grok into the project area.
 
-  $ grokproject --with-zope3=/usr/local/Zope-3.3.1 Sample
+.. XXX when grokproject gains a switch for pointing to a shared egg
+       directory, mention this here.
 
 grokproject will tell you what it will be creating::
 
@@ -166,8 +165,9 @@
   Enter user (Name of an initial administrator user): grok
   Enter passwd (Password for the initial administrator user): grok
 
-Now you have to wait a while as grokproject downloads Grok and
-possibly Zope 3 and sets up the project environment for you.
+Now you have to wait a while as grokproject downloads `zc.buildout`_
+(the system that's used to build the project area), Grok and the Zope
+3 libraries.
 
 After all that, Grok, along with a Zope 3 instance, is ready to go. 
 
@@ -182,7 +182,7 @@
 directory. You can start it (into the foreground) by typing the
 following::
 
-  $ parts/instance/bin/zopectl fg
+  $ bin/instance fg
 
 This will make Zope 3 available on port 8080, and you can log in with
 username ``grok`` and password ``grok``. Assuming you've started up
@@ -219,7 +219,7 @@
 
 Practice restarting Zope now, as you'll end up doing it a lot during
 this tutorial. It's just stopping Zope and starting it again:
-`CTRL-c`` and then ``parts/instance/bin/zopectl fg`` from your Sample
+`CTRL-c`` and then ``bin/instance fg`` from your Sample
 project directory.
 
 An empty Grok project
@@ -247,10 +247,8 @@
 more detail later in this tutorial. (XXX)
 
 We have already seen the ``parts`` directory. This directory contains
-all software installed by grokproject that is not a simple Python
-library. The only part interesting to us right now is the ``instance``
-directory, which contains the ``zopectl`` script to start up Zope which
-we used before.
+configuration and data created by ``buildout``, such as the Zope
+object database (ZODB) instance.
 
 The actual code of the project will all be inside the ``src``
 directory. In it is a Python package directory called ``sample`` with
@@ -276,9 +274,10 @@
 This is the template for your project's welcome page.
 
 What's left is a ``configure.zcml`` file. Unlike in typical Zope 3
-applications, this will only ever contain a single line that registers
-this application with Zope 3. This means we can typically completely
-ignore it, but we'll show it here once for good measure:
+applications, this will only ever contain a few lines that load Grok
+and then register this application with Grok. This means we can
+typically completely ignore it, but we'll show it here once for good
+measure:
 
 .. include:: groktut/an_empty_grok_project/src/sample/configure.zcml
    :literal:

Modified: grok/trunk/grokwiki/setup.py
===================================================================
--- grok/trunk/grokwiki/setup.py	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/grokwiki/setup.py	2007-07-12 13:45:23 UTC (rev 77736)
@@ -16,5 +16,6 @@
     license='ZPL',
 
     install_requires=['setuptools',
-                     ],
+                      'grok',
+                      ],
 )

Modified: grok/trunk/grokwiki/src/grokwiki/configure.zcml
===================================================================
--- grok/trunk/grokwiki/src/grokwiki/configure.zcml	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/grokwiki/src/grokwiki/configure.zcml	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1 +1,5 @@
-<grok package="." xmlns="http://namespaces.zope.org/grok" />
\ No newline at end of file
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:grok="http://namespaces.zope.org/grok">
+  <include package="grok" />
+  <grok:grok package="." />
+</configure>
\ No newline at end of file

Modified: grok/trunk/setup.py
===================================================================
--- grok/trunk/setup.py	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/setup.py	2007-07-12 13:45:23 UTC (rev 77736)
@@ -18,5 +18,35 @@
     install_requires=['setuptools',
                       'martian',
                       'simplejson',
-                      'zc.catalog == 1.1.1'],
+                      'pytz',
+                      'ZODB3',
+                      'zope.annotation',
+                      'zope.app.catalog',
+                      'zope.app.component',
+                      'zope.app.container',
+                      'zope.app.folder',
+                      'zope.app.intid',
+                      'zope.app.pagetemplate',
+                      'zope.app.publication',
+                      'zope.app.publisher',
+                      'zope.app.testing',
+                      'zope.component',
+                      'zope.configuration',
+                      'zope.dottedname',
+                      'zope.event',
+                      'zope.formlib',
+                      'zope.interface',
+                      'zope.lifecycleevent',
+                      'zope.pagetemplate',
+                      'zope.publisher',
+                      'zope.schema',
+                      'zope.security',
+                      'zope.testing',
+                      'zope.traversing',
+                      'zope.testbrowser',
+                      'zope.app.twisted',
+                      'zope.app.securitypolicy',
+                      'zope.app.zcmlfiles',
+                      'zc.catalog',
+                      ],
 )

Modified: grok/trunk/src/grok/configure.zcml
===================================================================
--- grok/trunk/src/grok/configure.zcml	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/src/grok/configure.zcml	2007-07-12 13:45:23 UTC (rev 77736)
@@ -2,6 +2,27 @@
     xmlns="http://namespaces.zope.org/zope"
     xmlns:grok="http://namespaces.zope.org/grok">
 
+  <include package="zope.security" file="meta.zcml" />
+  <include package="zope.i18n" file="meta.zcml" />
+  <include package="zope.app.securitypolicy" file="meta.zcml" />
+  <include package="zope.app.zcmlfiles" file="meta.zcml" />
+  <include package="grok" file="meta.zcml" />
+
+  <include package="zope.annotation" />
+  <include package="zope.copypastemove" />
+  <include package="zope.formlib" />
+  <include package="zope.i18n.locales" />
+  <include package="zope.publisher" />
+  <include package="zope.size" />
+  <include package="zope.traversing" />
+  <include package="zope.traversing.browser" />
+  <include package="zope.app.zcmlfiles" />
+  <include package="zope.app.securitypolicy" />
+  <include package="zope.app.authentication" />
+  <include package="zope.app.intid" />
+  <include package="zope.app.keyreference" />
+  <include package="zope.app.catalog" />
+
   <!-- we register special IAbsoluteURL views on grok views so that
        can have them inspect __view_name__ instead of __name__.  
        __name__ is already used as the class name, and overriding it

Copied: grok/trunk/src/grok/ftesting.zcml (from rev 77735, grok/branches/philikon-eggs2/src/grok/ftesting.zcml)
===================================================================
--- grok/trunk/src/grok/ftesting.zcml	                        (rev 0)
+++ grok/trunk/src/grok/ftesting.zcml	2007-07-12 13:45:23 UTC (rev 77736)
@@ -0,0 +1,33 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   i18n_domain="grok"
+   package="grok"
+   >
+
+  <include package="grok" />
+
+  <securityPolicy
+      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      />
+
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User"
+      />
+  <grant
+      permission="zope.View"
+      principal="zope.anybody"
+      />
+
+  <principal
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw"
+      />
+
+  <role id="zope.Manager" title="Site Manager" />
+  <grantAll role="zope.Manager" />
+  <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>

Modified: grok/trunk/src/grok/ftests/test_grok_functional.py
===================================================================
--- grok/trunk/src/grok/ftests/test_grok_functional.py	2007-07-12 13:40:38 UTC (rev 77735)
+++ grok/trunk/src/grok/ftests/test_grok_functional.py	2007-07-12 13:45:23 UTC (rev 77736)
@@ -1,45 +1,21 @@
 import unittest
+import grok
+import os.path
+
 from pkg_resources import resource_listdir
 from zope.testing import doctest
 from zope.app.testing.functional import (HTTPCaller, getRootFolder,
-                                         FunctionalTestSetup, sync, Functional)
+                                         FunctionalTestSetup, sync, ZCMLLayer)
 
-# XXX bastardized from zope.app.testing.functional.FunctionalDocFileSuite :-(
-def FunctionalDocTestSuite(*paths, **kw):
-    globs = kw.setdefault('globs', {})
-    globs['http'] = HTTPCaller()
-    globs['getRootFolder'] = getRootFolder
-    globs['sync'] = sync
+ftesting_zcml = os.path.join(os.path.dirname(grok.__file__), 'ftesting.zcml')
+GrokFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'GrokFunctionalLayer')
 
-    #kw['package'] = doctest._normalize_module(kw.get('package'))
+def setUp(test):
+    FunctionalTestSetup().setUp()
 
-    kwsetUp = kw.get('setUp')
-    def setUp(test):
-        FunctionalTestSetup().setUp()
+def tearDown(test):
+    FunctionalTestSetup().tearDown()
 
-        if kwsetUp is not None:
-            kwsetUp(test)
-    kw['setUp'] = setUp
-
-    kwtearDown = kw.get('tearDown')
-    def tearDown(test):
-        if kwtearDown is not None:
-            kwtearDown(test)
-        FunctionalTestSetup().tearDown()
-    kw['tearDown'] = tearDown
-
-    if 'optionflags' not in kw:
-        old = doctest.set_unittest_reportflags(0)
-        doctest.set_unittest_reportflags(old)
-        kw['optionflags'] = (old
-                             | doctest.ELLIPSIS
-                             | doctest.REPORT_NDIFF
-                             | doctest.NORMALIZE_WHITESPACE)
-
-    suite = doctest.DocTestSuite(*paths, **kw)
-    suite.layer = Functional
-    return suite
-
 def suiteFromPackage(name):
     files = resource_listdir(__name__, name)
     suite = unittest.TestSuite()
@@ -50,7 +26,16 @@
             continue
 
         dottedname = 'grok.ftests.%s.%s' % (name, filename[:-3])
-        test = FunctionalDocTestSuite(dottedname)
+        test = doctest.DocTestSuite(
+            dottedname, setUp=setUp, tearDown=tearDown,
+            extraglobs=dict(http=HTTPCaller(),
+                            getRootFolder=getRootFolder,
+                            sync=sync),
+            optionflags=(doctest.ELLIPSIS+
+                         doctest.NORMALIZE_WHITESPACE+
+                         doctest.REPORT_NDIFF)
+            )
+        test.layer = GrokFunctionalLayer
 
         suite.addTest(test)
     return suite



More information about the Checkins mailing list