[Checkins] SVN: grokproject/trunk/ Merge fanstatic branch
Jan-Jaap Driessen
jdriessen at thehealthagency.com
Wed Jan 19 16:13:25 EST 2011
Log message for revision 119736:
Merge fanstatic branch
Changed:
U grokproject/trunk/CHANGES.txt
U grokproject/trunk/grokproject/template/buildout.cfg_tmpl
U grokproject/trunk/grokproject/template/etc/debug.ini.in_tmpl
U grokproject/trunk/grokproject/template/etc/deploy.ini.in_tmpl
U grokproject/trunk/grokproject/template/setup.py_tmpl
U grokproject/trunk/grokproject/template/src/+package+/app.py_tmpl
D grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl
U grokproject/trunk/grokproject/template/src/+package+/app_templates/index.pt_tmpl
D grokproject/trunk/grokproject/template/src/+package+/ftesting.zcml_tmpl
A grokproject/trunk/grokproject/template/src/+package+/tests/
D grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl
U grokproject/trunk/grokproject/templates.py
U grokproject/trunk/grokproject/utils.py
U grokproject/trunk/tests_paste.txt
-=-
Modified: grokproject/trunk/CHANGES.txt
===================================================================
--- grokproject/trunk/CHANGES.txt 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/CHANGES.txt 2011-01-19 21:13:25 UTC (rev 119736)
@@ -4,9 +4,47 @@
2.4 (unreleased)
----------------
-- Nothing changed yet.
+- z3c.testsetup has been removed in favor of manual registration of tests.
+ Tests have been moved to 'tests' subdirectory.
+ See tests.py for more information on how to register tests.
+- The 'static' directory is no longer grokked and registered as a
+ DirectoryResource. It has been superseded by `fanstatic`_.
+ In order to update your current grok project to the most recent grokproject,
+ you need to register a fanstatic Library for the `static` directory.
+
+ Include the following code in ``resource.py``::
+
+ from fanstatic import Library
+ library = Library('$name_of_your_project', 'static')
+
+ in the setup.py of your project, add the following entry point::
+
+ 'fanstatic.libraries': [
+ '$name_of_your_project = $name_of_your_project.resource:library',
+ ]
+
+ Also add `zope.fanstatic` and `fanstatic` to `install_requires` in your
+ setup.py. If you are using z3c.autoinclude in your configure.zcml, the
+ registrations of zope.fanstatic will be picked up automatically. If you
+ do not use z3c.autoinclude, include zope.fanstatic in your configure.zcml.
+
+- Split up zope.conf into zope.debug.conf and zope.deploy.conf, in order to
+ pick these up from the paster configs debug.ini and deploy.ini.
+
+ In debug/devmode, grok picks up changes in page templates and fanstatic
+ recalculates resources URLs.
+
+ In non-dev/deploy mode grok caches page templates and fanstatic caches
+ resource URLs.
+
+ The goal is to quickly see the difference between debug.ini and deploy.ini
+ without having to mess around in parts/etc.
+
+
+.. _`fanstatic`: http://fanstatic.org
+
2.3 (2011-01-10)
----------------
Modified: grokproject/trunk/grokproject/template/buildout.cfg_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/buildout.cfg_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/buildout.cfg_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -1,20 +1,22 @@
[buildout]
extends = ${version_info_url}
+# XXX do not use groktoolkit trunk for release.
+extends = http://svn.zope.org/repos/main/groktoolkit/trunk/grok.cfg
extends-cache = extends-cache
-find-links = ${find_links_url}
include-site-packages = ${include_site_packages}
develop = .
unzip = true
parts =
app
daemon
- debug_ini
- deploy_ini
+ paster_ini_debug
+ paster_ini_deploy
i18n
mkdirs
site_zcml
test
- zope_conf
+ zope_conf_debug
+ zope_conf_deploy
zpasswd
interactive_debugger
# For backward compatibility, telling buildout not to throw away
@@ -28,11 +30,22 @@
# unless you specify an eggs-directory option here.
${eggs_dir}
extensions += buildout.dumppickedversions
+ mr.developer
+always-checkout = true
+auto-checkout = grok
+ grokui.admin
+ zope.errorview
+[sources]
+grok = svn http://svn.zope.org/repos/main/grok/trunk
+zope.errorview = svn http://svn.zope.org/repos/main/zope.errorview/trunk
+
[versions]
# Override versions here.
# This version pin can be removed after the next groktoolkit release.
-collective.recipe.scriptgen = 0.2
+grokcore.view = 2.3
+grokui.base = 0.5
+fanstatic = 0.10
[app]
recipe = z3c.recipe.scripts
@@ -50,14 +63,14 @@
--daemon --pid-file=$${buildout:directory}/var/daemon.pid
--log-file=$${buildout:directory}/log/daemon.log
-[debug_ini]
+[paster_ini_debug]
recipe = collective.recipe.template
input = etc/debug.ini.in
output = $${buildout:parts-directory}/etc/debug.ini
host = 127.0.0.1
port = 8080
-[deploy_ini]
+[paster_ini_deploy]
recipe = collective.recipe.template
input = etc/deploy.ini.in
output = $${buildout:parts-directory}/etc/deploy.ini
@@ -91,15 +104,25 @@
defaults = ['-v']
[zope_conf]
-recipe = collective.recipe.template
input = etc/zope.conf.in
-output = $${buildout:parts-directory}/etc/zope.conf
filestorage = $${buildout:directory}/var/filestorage
blobstorage = $${buildout:directory}/var/blobstorage
logfiles = $${buildout:directory}/var/log
+# 'extra' is copied verbatim. Use it for product config sections and so.
extra =
-# 'extra' is copied verbatim. Use it for product config sections and so.
+[zope_conf_debug]
+<= zope_conf
+recipe = collective.recipe.template
+output = $${buildout:parts-directory}/etc/zope.debug.conf
+devmode = on
+
+[zope_conf_deploy]
+<= zope_conf
+recipe = collective.recipe.template
+output = $${buildout:parts-directory}/etc/zope.deploy.conf
+devmode = off
+
# This section is named so that the zpasswd utility is
# called `zpasswd`
[zpasswd]
@@ -115,7 +138,7 @@
eggs = ${egg}
entry-points =
interactive_debugger=grokcore.startup.startup:interactive_debug_prompt
-arguments = zope_conf="$${zope_conf:output}"
+arguments = zope_conf="$${zope_conf_debug:output}"
# The [data] and [log] parts are still in here to instruct buildout to not
# unintentionally throw away the parts/data and parts/log subdirectories
Modified: grokproject/trunk/grokproject/template/etc/debug.ini.in_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/etc/debug.ini.in_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/etc/debug.ini.in_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -7,7 +7,7 @@
port = $${:port}
[pipeline:main]
-pipeline = accesslogging evalexception grok
+pipeline = accesslogging fanstatic evalexception grok
[filter:accesslogging]
use = egg:Paste#translogger
@@ -15,6 +15,11 @@
[filter:evalexception]
use = egg:z3c.evalexception#ajax
+[filter:fanstatic]
+use = egg:fanstatic#fanstatic
+versioning = true
+recompute_hashes = true
+
[app:grok]
use = egg:grokcore.startup#debug
exempt-exceptions = zope.security.interfaces.IUnauthorized
Modified: grokproject/trunk/grokproject/template/etc/deploy.ini.in_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/etc/deploy.ini.in_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/etc/deploy.ini.in_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -7,18 +7,25 @@
port = $${:port}
[pipeline:main]
-pipeline = accesslogging gzip grok
+pipeline = accesslogging gzip fanstatic grok
[filter:accesslogging]
use = egg:Paste#translogger
setup_console_handler = false
+[filter:fanstatic]
+use = egg:fanstatic#fanstatic
+bottom = true
+versioning = true
+minified = true
+rollup = true
+recompute_hashes = false
+
[filter:gzip]
use = egg:Paste#gzip
[app:grok]
use = egg:grokcore.startup
-setup_console_handler = False
# Logging configuration
Modified: grokproject/trunk/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/setup.py_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/setup.py_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -21,8 +21,13 @@
install_requires=['setuptools',
'grok',
'grokui.admin',
- 'z3c.testsetup',
+ 'fanstatic',
+ 'zope.fanstatic',
'grokcore.startup',${install_requires|nothing}
# Add extra requirements here
],
- )
+ entry_points={
+ 'fanstatic.libraries': [
+ '${project_lowercase} = ${project_lowercase}.resource:library',
+ ]
+ })
Modified: grokproject/trunk/grokproject/template/src/+package+/app.py_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/app.py_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/src/+package+/app.py_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -1,7 +1,10 @@
import grok
+from ${package} import resource
+
class ${app_class_name}(grok.Application, grok.Container):
pass
class Index(grok.View):
- pass # see app_templates/index.pt
+ def update(self):
+ resource.style.need()
Deleted: grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -1,46 +0,0 @@
-Do a functional doctest test on the app.
-========================================
-
-.. :doctest:
-.. :layer: ${package}.tests.browser_layer
-
-Let's first create an instance of ${app_class_name} at the top level:
-
- >>> from ${package}.app import ${app_class_name}
- >>> root = getRootFolder()
- >>> root['app'] = ${app_class_name}()
-
-Run tests in the testbrowser
-----------------------------
-
-The zope.testbrowser.browser module exposes a Browser class that
-simulates a web browser similar to Mozilla Firefox or IE. We use that
-to test how our application behaves in a browser. For more
-information, see http://pypi.python.org/pypi/zope.testbrowser.
-
-Create a browser and visit the instance you just created:
-
- >>> from zope.app.wsgi.testlayer import Browser
- >>> browser = Browser()
- >>> browser.open('http://localhost/app')
-
-Check some basic information about the page you visit:
-
- >>> browser.url
- 'http://localhost/app'
-
- >>> print browser.contents
- <html>
- <head>
- <base href="http://localhost/app/@@index" />
- <BLANKLINE>
- </head>
- <body>
- <h1>Congratulations!</h1>
- <BLANKLINE>
- <p>Your Grok application is up and running.
- Edit <code>${package}/app_templates/index.pt</code> to change
- this page.</p>
- </body>
- </html>
- <BLANKLINE>
Modified: grokproject/trunk/grokproject/template/src/+package+/app_templates/index.pt_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/app_templates/index.pt_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/src/+package+/app_templates/index.pt_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -7,5 +7,6 @@
<p>Your Grok application is up and running.
Edit <code>${package}/app_templates/index.pt</code> to change
this page.</p>
+ <img tal:attributes="src static/evencaveman.jpg"/>
</body>
</html>
Deleted: grokproject/trunk/grokproject/template/src/+package+/ftesting.zcml_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/ftesting.zcml_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/src/+package+/ftesting.zcml_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -1,47 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="${package}"
- package="${package}"
- >
-
- <include package="${package}" />
-
- <!-- Typical functional testing security setup -->
- <securityPolicy
- component="zope.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"
- />
-
- <grant
- permission="zope.View"
- principal="zope.Everybody"
- />
-
- <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>
Deleted: grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl 2011-01-19 21:13:25 UTC (rev 119736)
@@ -1,10 +0,0 @@
-import os.path
-import z3c.testsetup
-from zope.app.wsgi.testlayer import BrowserLayer
-
-import ${package}
-
-browser_layer = BrowserLayer(${package})
-
-test_suite = z3c.testsetup.register_all_tests(
- '${package}', globs={'getRootFolder': browser_layer.getRootFolder})
Modified: grokproject/trunk/grokproject/templates.py
===================================================================
--- grokproject/trunk/grokproject/templates.py 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/templates.py 2011-01-19 21:13:25 UTC (rev 119736)
@@ -72,6 +72,7 @@
# Escape values that go in site.zcml.
vars[var_name] = xml.sax.saxutils.quoteattr(vars[var_name])
vars['app_class_name'] = vars['project'].capitalize()
+ vars['project_lowercase'] = vars['project'].lower()
# Handling the version.cfg file.
version_url = vars.get('version_url')
@@ -127,7 +128,7 @@
sys.exit(1)
except IOError, e:
# Some serious problem: no connect to server...
- print "Error: cannot download required %s" % version_info_url
+ print "Error: cannot download required %s" % url
print "Server may be down. Please try again later."
sys.exit(1)
return contents
Modified: grokproject/trunk/grokproject/utils.py
===================================================================
--- grokproject/trunk/grokproject/utils.py 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/grokproject/utils.py 2011-01-19 21:13:25 UTC (rev 119736)
@@ -1,15 +1,11 @@
-from base64 import urlsafe_b64encode
-from paste.script.templates import var
-from random import randint
import subprocess
import codecs
-import logging
import os
-import pkg_resources
-import shutil
import sys
-import tempfile
+from base64 import urlsafe_b64encode
+from paste.script.templates import var
+
try:
from hashlib import sha1
except ImportError:
Modified: grokproject/trunk/tests_paste.txt
===================================================================
--- grokproject/trunk/tests_paste.txt 2011-01-19 20:56:14 UTC (rev 119735)
+++ grokproject/trunk/tests_paste.txt 2011-01-19 21:13:25 UTC (rev 119736)
@@ -13,13 +13,13 @@
>>> executable = [os.path.join(current_dir, 'bin', 'grokproject')]
>>> opts = ['--user=a', '--passwd=a', '--eggs-dir=' + eggsdir]
>>> version = [
- ... '--version-url=http://grok.zope.org/releaseinfo/1.2b/versions.cfg']
+ ... '--version-url=http://grok.zope.org/releaseinfo/1.2.1/versions.cfg']
>>> sh(executable + opts + version + ['GrokExample'])
['...grokproject',
'--user=a',
'--passwd=a',
'--eggs-dir=...grokproject-test-eggs',
- '--version-url=http://grok.zope.org/releaseinfo/1.2b/versions.cfg',
+ '--version-url=http://grok.zope.org/releaseinfo/1.2.1/versions.cfg',
'GrokExample']...
Creating directory '...bin'.
Creating directory '...parts'.
@@ -31,23 +31,26 @@
Generated interpreter '...python-console'.
Installing daemon.
Generated script '...daemon'.
- Installing debug_ini.
- Installing deploy_ini.
+ Installing paster_ini_debug.
+ Installing paster_ini_deploy.
Installing i18n.
i18n: setting up i18n tools
Generated script '...i18nextract'.
Generated script '...i18nmergeall'.
Generated script '...i18nstats'.
Generated script '...i18ncompile'.
- Installing site_zcml.
- Installing zope_conf.
Installing mkdirs.
mkdirs: created path: ...var
mkdirs: created path: ...filestorage
mkdirs: created path: ...log
mkdirs: created path: ...blobstorage
+ Installing site_zcml.
Installing test.
Generated script '...test'.
+ Installing zope_conf_debug.
+ ...
+ Installing zope_conf_deploy.
+ ...
Installing zpasswd.
Generated script '...zpasswd'.
Installing interactive_debugger.
@@ -68,15 +71,16 @@
>>> package_dir = os.path.join(testdir, 'GrokExample')
>>> print open(os.path.join(package_dir, 'buildout.cfg')).read()
[buildout]
- extends = http://grok.zope.org/releaseinfo/1.2b/versions.cfg
+ extends = http://grok.zope.org/releaseinfo/1.2.1/versions.cfg
+ ...
extends-cache = extends-cache
- find-links =
include-site-packages = false
develop = .
...
>>> ls(package_dir)
.installed.cfg
+ .mr.developer.cfg
bin
bootstrap.py
buildout.cfg
@@ -93,17 +97,17 @@
>>> ls(software_dir)
__init__.py
app.py
- app.txt
app_templates
configure.zcml
- ftesting.zcml
+ resource.py
static
- tests.py
+ tests
>>> bin_dir = os.path.join(package_dir, 'bin')
>>> ls(bin_dir)
buildout
daemon
+ develop
i18ncompile
i18nextract
i18nmergeall
@@ -119,13 +123,16 @@
debug.ini
deploy.ini
site.zcml
- zope.conf
+ zope.debug.conf
+ zope.deploy.conf
-In the generated configuration files paths are set to local paths:
+In the generated configuration files paths are set to local paths.
+We used a projectname with uppercase letters. This is respected by
+configuration files:
- >>> cat(etc_dir, 'zope.conf')
+ >>> cat(etc_dir, 'zope.debug.conf')
# Identify the component configuration used to define the site:
- site-definition /.../GrokExample/parts/etc/site.zcml
+ site-definition .../GrokExample/parts/etc/site.zcml
...
The eggs dir is filled now:
@@ -135,22 +142,13 @@
The extends-cache directive results in cached versions of the referenced
buildout files to support offline building. We know what the filename of the
-cached versions file for 1.2b will look like:
+cached versions file for 1.2.1 will look like:
- >>> ls(os.path.join(package_dir, 'extends-cache'))
- 0857a87803d0c8a371e867bd7d58a782
- 1cd99c06b44977edcb9281133f31007b
- f74256c0d403a6bb45c38b9ce42c783c
+ <<< ls(os.path.join(package_dir, 'extends-cache'))
+ 1db36734c0226e6f922ac9bb3361f6d8
+ 286c4c832f552bec68fcac956a6be5c6
+ 2a2cf1415ca2d47decad204083d1482c
-We used a projectname with uppercase letters. This is respected by
-configuration files:
-
- >>> zope_conf = os.path.join(package_dir, 'parts', 'etc', 'zope.conf')
- >>> print open(zope_conf, 'rb').read()
- # Identify the component configuration used to define the site:
- site-definition ...GrokExample/parts/etc/site.zcml
- ...
-
The password given is stored SSHA encoded:
>>> site_zcml_in = os.path.join(package_dir, 'etc',
@@ -263,15 +261,22 @@
>>> cmd = os.path.join(bin_dir, 'test')
>>> output = read_sh(cmd)
>>> print 'Test:\n' + output
- Test...
+ Test:
Running tests at level 1
- Running grokexample.BrowserLayer tests:
- Set up grokexample.BrowserLayer in ... seconds.
+ Running grokexample.tests.ZopeFanstaticBrowserLayer tests:
+ Set up grokexample.tests.ZopeFanstaticBrowserLayer... in ... seconds.
Running:
- ...
- Ran 3 tests with 0 failures and 0 errors in ... seconds.
+ ..
+ Ran 2 tests with 0 failures and 0 errors in ... seconds.
+ Running zope.testrunner.layer.UnitTests tests:
+ Tear down grokexample.tests.ZopeFanstaticBrowserLayer in ... seconds.
+ Set up zope.testrunner.layer.UnitTests in ... seconds.
+ Running:
+ .
+ Ran 1 tests with 0 failures and 0 errors in ... seconds.
Tearing down left over layers:
- Tear down grokexample.BrowserLayer in ... seconds.
+ Tear down zope.testrunner.layer.UnitTests in ... seconds.
+ Total: 3 tests, 0 failures, 0 errors in ... seconds.
<BLANKLINE>
Using the generated `buildout` script
@@ -284,18 +289,21 @@
>>> cd(package_dir)
>>> cmd = os.path.join(bin_dir, 'buildout')
>>> output = read_sh(cmd)
- >>> print output
+ >>> print 'Test\n', output
+ Test
+ ...
Develop: ...
Updating app.
Updating daemon.
- Updating debug_ini.
- Updating deploy_ini.
+ Updating paster_ini_debug.
+ Updating paster_ini_deploy.
Updating i18n.
i18n: setting up i18n tools
+ Updating mkdirs.
Updating site_zcml.
- Updating zope_conf.
- Updating mkdirs.
Updating test.
+ Updating zope_conf_debug.
+ Updating zope_conf_deploy.
Updating zpasswd.
Updating interactive_debugger.
Updating data.
More information about the checkins
mailing list