[Checkins] SVN: z3c.pagelet/trunk/ - Moved z3c.pt include to extras_require chameleon. This makes the package
Roger Ineichen
roger at projekt01.ch
Sat Oct 29 21:02:09 UTC 2011
Log message for revision 123180:
- Moved z3c.pt include to extras_require chameleon. This makes the package
independent from chameleon and friends and allows to include this
dependencies in your own project.
- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
z3c.ptcompat packages adjusted to work with chameleon 2.0.
See the notes from the z3c.ptcompat package:
Update z3c.ptcompat implementation to use component-based template engine
configuration, plugging directly into the Zope Toolkit framework.
The z3c.ptcompat package no longer provides template classes, or ZCML
directives; you should import directly from the ZTK codebase.
Note that the ``PREFER_Z3C_PT`` environment option has been
rendered obsolete; instead, this is now managed via component
configuration.
Also note that the chameleon CHAMELEON_CACHE environment value changed from
True/False to a path. Skip this property if you don't like to use a cache.
None or False defined in buildout environment section doesn't work. At least
with chameleon <= 2.5.4
Attention: You need to include the configure.zcml file from z3c.ptcompat
for enable the z3c.pt template engine. The configure.zcml will plugin the
template engine. Also remove any custom built hooks which will import
z3c.ptcompat in your tests or other places.
Changed:
U z3c.pagelet/trunk/CHANGES.txt
U z3c.pagelet/trunk/buildout.cfg
U z3c.pagelet/trunk/setup.py
U z3c.pagelet/trunk/src/z3c/pagelet/README.txt
U z3c.pagelet/trunk/src/z3c/pagelet/tests.py
-=-
Modified: z3c.pagelet/trunk/CHANGES.txt
===================================================================
--- z3c.pagelet/trunk/CHANGES.txt 2011-10-29 21:00:50 UTC (rev 123179)
+++ z3c.pagelet/trunk/CHANGES.txt 2011-10-29 21:02:09 UTC (rev 123180)
@@ -2,12 +2,39 @@
CHANGES
=======
-1.2.3 (unreleased)
+1.3.0 (2011-10-29)
------------------
-- ...
+- Moved z3c.pt include to extras_require chameleon. This makes the package
+ independent from chameleon and friends and allows to include this
+ dependencies in your own project.
+- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
+ z3c.ptcompat packages adjusted to work with chameleon 2.0.
+
+ See the notes from the z3c.ptcompat package:
+ Update z3c.ptcompat implementation to use component-based template engine
+ configuration, plugging directly into the Zope Toolkit framework.
+
+ The z3c.ptcompat package no longer provides template classes, or ZCML
+ directives; you should import directly from the ZTK codebase.
+
+ Note that the ``PREFER_Z3C_PT`` environment option has been
+ rendered obsolete; instead, this is now managed via component
+ configuration.
+
+ Also note that the chameleon CHAMELEON_CACHE environment value changed from
+ True/False to a path. Skip this property if you don't like to use a cache.
+ None or False defined in buildout environment section doesn't work. At least
+ with chameleon <= 2.5.4
+
+ Attention: You need to include the configure.zcml file from z3c.ptcompat
+ for enable the z3c.pt template engine. The configure.zcml will plugin the
+ template engine. Also remove any custom built hooks which will import
+ z3c.ptcompat in your tests or other places.
+
+
1.2.2 (2011-08-18)
------------------
Modified: z3c.pagelet/trunk/buildout.cfg
===================================================================
--- z3c.pagelet/trunk/buildout.cfg 2011-10-29 21:00:50 UTC (rev 123179)
+++ z3c.pagelet/trunk/buildout.cfg 2011-10-29 21:02:09 UTC (rev 123180)
@@ -1,21 +1,37 @@
[buildout]
develop = .
-parts = test docs
+parts = test coverage-test coverage-report docs
versions = versions
+
[versions]
-z3c.pt = 1.2.1
-Chameleon = 1.2.13
+lxml = 2.3 # no windows release for 3.2.1
+
+[test-environment]
+CHAMELEON_DEBUG = False
+
+
[test]
recipe = zc.recipe.testrunner
eggs = z3c.pagelet [test]
environment = test-environment
-[test-environment]
-CHAMELEON_DEBUG = False
-CHAMELEON_CACHE = False
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = z3c.pagelet [test]
+defaults = ['--coverage', '../../coverage']
+environment = test-environment
+
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coveragereport
+arguments = ('parts/coverage', 'parts/coverage/report')
+
+
[docs]
recipe = z3c.recipe.sphinxdoc
eggs = z3c.pagelet [docs]
Modified: z3c.pagelet/trunk/setup.py
===================================================================
--- z3c.pagelet/trunk/setup.py 2011-10-29 21:00:50 UTC (rev 123179)
+++ z3c.pagelet/trunk/setup.py 2011-10-29 21:02:09 UTC (rev 123180)
@@ -22,7 +22,7 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version = '1.2.3dev'
+version = '1.3.0'
setup(
name='z3c.pagelet',
@@ -54,21 +54,27 @@
package_dir = {'':'src'},
namespace_packages = ['z3c'],
extras_require = dict(
- test = ['zope.app.testing',
- 'zope.app.form',
- 'zope.testing',
- 'zope.traversing',
- 'lxml>=2.1.1',
- 'z3c.pt>=1.0b4',
- 'z3c.ptcompat',
- 'zope.formlib',
- ],
- docs = ['z3c.recipe.sphinxdoc'],
+ test = [
+ 'zope.app.testing',
+ 'zope.app.form',
+ 'zope.testing',
+ 'zope.traversing',
+ 'lxml>=2.1.1',
+ 'z3c.pt >= 2.1',
+ 'z3c.ptcompat>=1.0',
+ 'zope.formlib',
+ ],
+ chameleon = [
+ 'z3c.pt >= 2.1',
+ 'z3c.ptcompat',
+ ],
+ docs = [
+ 'z3c.recipe.sphinxdoc'
+ ],
),
install_requires = [
'setuptools',
'z3c.template>=1.2.0',
- 'z3c.ptcompat',
# TODO: this is only needed for ZCML directives, so can copy
'zope.browserpage', # things we use from there and get rid of the dependencies.
'zope.component>=3.7.0',
Modified: z3c.pagelet/trunk/src/z3c/pagelet/README.txt
===================================================================
--- z3c.pagelet/trunk/src/z3c/pagelet/README.txt 2011-10-29 21:00:50 UTC (rev 123179)
+++ z3c.pagelet/trunk/src/z3c/pagelet/README.txt 2011-10-29 21:02:09 UTC (rev 123180)
@@ -192,6 +192,7 @@
Traceback (most recent call last):
...
ContentProviderLookupError: pagelet
+ ...
That's right, we need to register the content provider ``pagelet`` before we
can use it.
@@ -343,8 +344,6 @@
Now render the form:
- >>> from z3c.ptcompat.testing import render
-
>>> addForm = MyAddForm(root, request)
>>> print addForm()
<html>
Modified: z3c.pagelet/trunk/src/z3c/pagelet/tests.py
===================================================================
--- z3c.pagelet/trunk/src/z3c/pagelet/tests.py 2011-10-29 21:00:50 UTC (rev 123179)
+++ z3c.pagelet/trunk/src/z3c/pagelet/tests.py 2011-10-29 21:02:09 UTC (rev 123180)
@@ -16,10 +16,14 @@
"""
__docformat__ = "reStructuredText"
+import re
import unittest
import itertools
import doctest
+import lxml.etree
+import lxml.doctestcompare
+
import zope.component
import zope.schema
import zope.traversing.adapters
@@ -33,8 +37,57 @@
from zope.formlib import form
from zope.configuration import xmlconfig
-import z3c.ptcompat.testing
+class OutputChecker(lxml.doctestcompare.LHTMLOutputChecker):
+ """Doctest output checker which is better equippied to identify
+ HTML markup than the checker from the ``lxml.doctestcompare``
+ module. It also uses the text comparison function from the
+ built-in ``doctest`` module to allow the use of ellipsis."""
+
+ _repr_re = re.compile(r"^<([A-Z]|[^>]+ (at|object) |[a-z]+ \'[A-Za-z0-9_.]+\'>)")
+
+ def __init__(self, doctest=doctest):
+ self.doctest = doctest
+ # make sure these optionflags are registered
+ doctest.register_optionflag('PARSE_HTML')
+ doctest.register_optionflag('PARSE_XML')
+ doctest.register_optionflag('NOPARSE_MARKUP')
+
+ def _looks_like_markup(self, s):
+ s = s.replace('<BLANKLINE>', '\n').strip()
+ return (s.startswith('<')
+ and not self._repr_re.search(s))
+
+ def text_compare(self, want, got, strip):
+ if want is None: want = ""
+ if got is None: got = ""
+ checker = self.doctest.OutputChecker()
+ return checker.check_output(
+ want, got, self.doctest.ELLIPSIS|self.doctest.NORMALIZE_WHITESPACE)
+
+ def get_parser(self, want, got, optionflags):
+ NOPARSE_MARKUP = self.doctest.OPTIONFLAGS_BY_NAME.get(
+ "NOPARSE_MARKUP", 0)
+ PARSE_HTML = self.doctest.OPTIONFLAGS_BY_NAME.get(
+ "PARSE_HTML", 0)
+ PARSE_XML = self.doctest.OPTIONFLAGS_BY_NAME.get(
+ "PARSE_XML", 0)
+ parser = None
+ if NOPARSE_MARKUP & optionflags:
+ return None
+ if PARSE_HTML & optionflags:
+ parser = lxml.doctestcompare.html_fromstring
+ elif PARSE_XML & optionflags:
+ parser = lxml.etree.XML
+ elif (want.strip().lower().startswith('<html')
+ and got.strip().startswith('<html')):
+ parser = lxml.doctestcompare.html_fromstring
+ elif (self._looks_like_markup(want)
+ and self._looks_like_markup(got)):
+ parser = self.get_default_parser()
+ return parser
+
+
def setUp(test):
root = setup.placefulSetUp(site=True)
test.globs['root'] = root
@@ -66,7 +119,6 @@
zope.component.provideAdapter(form.render_submit_button, name='render')
def setUpZPT(test):
- z3c.ptcompat.config.disable()
setUp(test)
# register provider TALES
@@ -75,15 +127,17 @@
metaconfigure.registerType('provider', tales.TALESProviderExpression)
def setUpZ3CPT(suite):
- z3c.ptcompat.config.enable()
setUp(suite)
+ import z3c.pt
+ import z3c.ptcompat
xmlconfig.XMLConfig('configure.zcml', z3c.pt)()
+ xmlconfig.XMLConfig('configure.zcml', z3c.ptcompat)()
def tearDown(test):
setup.placefulTearDown()
def test_suite():
- checker = z3c.ptcompat.testing.OutputChecker()
+ checker = OutputChecker()
tests = ((
doctest.DocFileSuite('README.txt',
More information about the checkins
mailing list