[Checkins] SVN: z3c.form/trunk/ Updated package to z3c.pt 1.0b1 (now Chameleon-based).

Malthe Borch mborch at gmail.com
Thu Oct 2 15:58:04 EDT 2008


Log message for revision 91676:
  Updated package to z3c.pt 1.0b1 (now Chameleon-based).

Changed:
  U   z3c.form/trunk/CHANGES.txt
  U   z3c.form/trunk/buildout.cfg
  U   z3c.form/trunk/setup.py
  U   z3c.form/trunk/src/z3c/form/testing.py

-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt	2008-10-02 19:51:21 UTC (rev 91675)
+++ z3c.form/trunk/CHANGES.txt	2008-10-02 19:58:03 UTC (rev 91676)
@@ -5,6 +5,9 @@
 Version 2.0.0 (2008-??-??)
 --------------------------
 
+- Updated package to work with ``z3c.pt`` version 1.0b1 (which is
+  now based on the Chameleon template compiler). [malthe]
+
 - Feature: Added support in the file upload widget's testing flavor to specify
   'base64'-encoded strings in the hidden text area, so that binary data can be
   uploaded as well.

Modified: z3c.form/trunk/buildout.cfg
===================================================================
--- z3c.form/trunk/buildout.cfg	2008-10-02 19:51:21 UTC (rev 91675)
+++ z3c.form/trunk/buildout.cfg	2008-10-02 19:58:03 UTC (rev 91676)
@@ -9,8 +9,8 @@
 zope.app.locales = 3.4.5
 
 [test-environment]
-Z3C_PT_DEBUG = False
-Z3C_PT_CACHE = False
+CHAMELEON_DEBUG = False
+CHAMELEON_CACHE = False
 
 [test]
 recipe = zc.recipe.testrunner
@@ -57,5 +57,5 @@
 defaults = ['-m', 'benchmark']
 
 [benchmark-environment]
-Z3C_PT_DEBUG = False
-Z3C_PT_CACHE = True
+CHAMELEON_DEBUG = False
+CHAMELEON_CACHE = True

Modified: z3c.form/trunk/setup.py
===================================================================
--- z3c.form/trunk/setup.py	2008-10-02 19:51:21 UTC (rev 91675)
+++ z3c.form/trunk/setup.py	2008-10-02 19:58:03 UTC (rev 91676)
@@ -82,7 +82,7 @@
             'zope.testing',
             'z3c.coverage',
             'z3c.template',
-            'z3c.pt',
+            'z3c.pt >= 1.0b1',
             'lxml',
             ],
         adding = ['zope.app.container'],
@@ -104,7 +104,7 @@
         'zope.schema',
         'zope.security',
         'zope.traversing',
-        'z3c.pt.compat',
+        'z3c.pt.compat >= 0.3',
         ],
     dependency_links = ['http://download.zope.org/distribution'],
     zip_safe = False,

Modified: z3c.form/trunk/src/z3c/form/testing.py
===================================================================
--- z3c.form/trunk/src/z3c/form/testing.py	2008-10-02 19:51:21 UTC (rev 91675)
+++ z3c.form/trunk/src/z3c/form/testing.py	2008-10-02 19:58:03 UTC (rev 91676)
@@ -40,6 +40,9 @@
 from z3c.form.browser import radio, select, text, textarea
 from z3c.form.browser import file as fileWidget
 
+from z3c.pt.compat.testing import render
+from z3c.pt.compat.testing import OutputChecker
+
 import z3c.pt.compat
 
 import lxml.html
@@ -65,26 +68,6 @@
 
         return super(TestingFileUploadDataConverter, self).toFieldValue(value)
 
-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 _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 = doctest.OutputChecker()
-        return checker.check_output(
-            want, got, doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE)
-
 class TestRequest(TestRequest):
     zope.interface.implements(interfaces.IFormLayer)
 
@@ -118,35 +101,6 @@
                 return True
         return False
 
-def render(view, xpath='.'):
-    string = view.render()
-    if string == "":
-        return string
-
-    try:
-        root = lxml.etree.fromstring(string)
-    except lxml.etree.XMLSyntaxError:
-        root = lxml.html.fromstring(string)
-
-    output = ""
-    for node in root.xpath(
-        xpath, namespaces={'xmlns': 'http://www.w3.org/1999/xhtml'}):
-        s = lxml.etree.tounicode(node, pretty_print=True)
-        s = s.replace(' xmlns="http://www.w3.org/1999/xhtml"', ' ')
-        output += s
-
-    if not output:
-        raise ValueError("No elements matched by %s." % repr(xpath))
-
-    # let's get rid of blank lines
-    output = output.replace('\n\n', '\n')
-
-    # self-closing tags are more readable with a space before the
-    # end-of-tag marker
-    output = output.replace('"/>', '" />')
-
-    return output
-
 def getPath(filename):
     return os.path.join(os.path.dirname(browser.__file__), filename)
 



More information about the Checkins mailing list