From ldr at codespeak.net Wed Jan 13 17:07:13 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 13 Jan 2010 17:07:13 +0100 (CET) Subject: [z3-checkins] r70567 - z3/xdv/trunk/lib/xdv Message-ID: <20100113160713.93507168048@codespeak.net> Author: ldr Date: Wed Jan 13 17:07:13 2010 New Revision: 70567 Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: Factor out inclusions to prepare for SSI / ESI support Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Wed Jan 13 17:07:13 2010 @@ -194,21 +194,17 @@ - - - document('', .) - - + + + + - - - document('', .) - - + + + + @@ -289,13 +285,11 @@ - - - document('', .) - - + include the @content. --> + + + + @@ -308,18 +302,16 @@ - + document('', .) - - - document('', .) - - + + + + @@ -362,21 +354,17 @@ - - - document('', .) - - + + + + - - - document('', .) - - + + + + @@ -391,14 +379,11 @@ - - - document('', .) - - + the children and content. Just invclude the @content --> + + + + - + document('', .) - - - document('', .) - - + + + + @@ -441,21 +424,17 @@ - - - document('', .) - - + + + + - - - document('', .) - - + + + + @@ -489,21 +468,17 @@ - - - document('', .) - - + + + + - - - document('', .) - - + + + + @@ -521,6 +496,16 @@ + + + + + + document('', .) + + + From ldr at codespeak.net Wed Jan 13 20:15:40 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 13 Jan 2010 20:15:40 +0100 (CET) Subject: [z3-checkins] r70569 - z3/xdv/trunk/lib/xdv Message-ID: <20100113191540.B741C16804E@codespeak.net> Author: ldr Date: Wed Jan 13 20:15:33 2010 New Revision: 70569 Added: z3/xdv/trunk/lib/xdv/filter.xsl Modified: z3/xdv/trunk/lib/xdv/compiler.py z3/xdv/trunk/lib/xdv/compiler.xsl Log: Basic SSI href support for nginx. href urls must be absolute local paths. replace and copy without nocontent=drop will have problems in SSI mode Modified: z3/xdv/trunk/lib/xdv/compiler.py ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.py (original) +++ z3/xdv/trunk/lib/xdv/compiler.py Wed Jan 13 20:15:33 2010 @@ -50,7 +50,7 @@ return self.resolve_string(self.extra, context) -def compile_theme(rules, theme, extra=None, css=True, xinclude=False, update=True, trace=False, parser=None, compiler_parser=None): +def compile_theme(rules, theme, extra=None, css=True, xinclude=False, update=True, trace=False, includemode=None, parser=None, compiler_parser=None): """Invoke the xdv compiler """ rules_doc = etree.parse(rules) @@ -77,6 +77,9 @@ resolver = CompileResolver(etree.tostring(rules_doc)) if trace: params['trace'] = '1' + if includemode: + params['includemode'] = "'%s'" % includemode + compiler_parser.resolvers.add(resolver) compiled = compiler_transform(theme_doc, **params) for msg in compiler_transform.error_log: @@ -111,6 +114,9 @@ parser.add_option("--xinclude", action="store_true", help="Run XInclude on rules.xml", dest="xinclude", default=False) + parser.add_option("-i", "--includemode", metavar="INC", + help="include mode (document or ssi)", + dest="includemode", default='document') (options, args) = parser.parse_args() if len(args) !=2: @@ -120,7 +126,7 @@ if options.trace: logger.setLevel(logging.DEBUG) - output_xslt = compile_theme(rules=rules, theme=theme, extra=options.extra, trace=options.trace, xinclude=options.xinclude) + output_xslt = compile_theme(rules=rules, theme=theme, extra=options.extra, trace=options.trace, xinclude=options.xinclude, includemode=options.includemode) output_xslt.write(options.output, encoding='utf-8', pretty_print=options.pretty_print) if __name__ == '__main__': Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Wed Jan 13 20:15:33 2010 @@ -9,6 +9,8 @@ boilerplate.xsl + document + /_include @@ -499,12 +501,34 @@ - - - document('', .) - - + + + + + + + + + + + + document('', .) + + + + + + # include virtual="?content=" + + + + ERROR: Unknown includemode. + + + Added: z3/xdv/trunk/lib/xdv/filter.xsl ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/filter.xsl Wed Jan 13 20:15:33 2010 @@ -0,0 +1,13 @@ + + + + + / + + + + + WARNING: No content found + + + From ldr at codespeak.net Wed Jan 13 20:16:11 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 13 Jan 2010 20:16:11 +0100 (CET) Subject: [z3-checkins] r70570 - in z3/xdv/trunk: . examples examples/nginx Message-ID: <20100113191611.11FE416804E@codespeak.net> Author: ldr Date: Wed Jan 13 20:16:08 2010 New Revision: 70570 Removed: z3/xdv/trunk/examples/theme.xsl Modified: z3/xdv/trunk/examples/nginx/nginx.conf.in z3/xdv/trunk/examples/rules.xml z3/xdv/trunk/nginx.cfg Log: nginx ssi include example Modified: z3/xdv/trunk/examples/nginx/nginx.conf.in ============================================================================== --- z3/xdv/trunk/examples/nginx/nginx.conf.in (original) +++ z3/xdv/trunk/examples/nginx/nginx.conf.in Wed Jan 13 20:16:08 2010 @@ -1,4 +1,5 @@ -worker_processes 2; +worker_processes 1; +error_log ${buildout:directory}/var/log/nginx-error.log debug; events { # worker_connections 1024; @@ -14,11 +15,17 @@ root ${nginx-conf:root}; autoindex on; + location = /styled/ { + alias ${nginx-conf:root}; + # don't style the index page, we include it + } + location /styled { alias ${nginx-conf:root}; - xslt_stylesheet ${nginx-conf:root}/theme.xsl; + xslt_stylesheet ${nginx-conf:theme-xsl}; xslt_html_parser on; xslt_types text/html; + ssi on; } location /styled/ploneorg { @@ -27,5 +34,25 @@ xslt_html_parser on; xslt_types text/html; } + + location = /_include_400 { + return 400; + } + + location /_include { + alias ${nginx-conf:root}; + error_page 400 = /_include_400; + if ($arg_content !~ .) { + return 400; + } + +# location ~ ^/_include(.+)$ { +# echo_location_async $1; + xslt_stylesheet ${nginx-conf:filter-xsl} + content=$arg_content + ; + xslt_html_parser on; + xslt_types text/html; + } } } Modified: z3/xdv/trunk/examples/rules.xml ============================================================================== --- z3/xdv/trunk/examples/rules.xml (original) +++ z3/xdv/trunk/examples/rules.xml Wed Jan 13 20:16:08 2010 @@ -5,6 +5,7 @@ + Deleted: /z3/xdv/trunk/examples/theme.xsl ============================================================================== --- /z3/xdv/trunk/examples/theme.xsl Wed Jan 13 20:16:08 2010 +++ (empty file) @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Theme Page Title -

Theme Page Heading

- - -
-

Theme Page Heading

-
Theme content to replace.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file Modified: z3/xdv/trunk/nginx.cfg ============================================================================== --- z3/xdv/trunk/nginx.cfg (original) +++ z3/xdv/trunk/nginx.cfg Wed Jan 13 20:16:08 2010 @@ -3,11 +3,12 @@ parts += nginx nginx-conf + compile-theme [nginx] recipe = zc.recipe.cmmi -url = http://html-xslt.googlecode.com/files/nginx-0.7.64-html-xslt.tar.gz -md5sum = f7eb0fef7cd0317294431153ce8e1817 +url = http://html-xslt.googlecode.com/files/nginx-0.7.64-html-xslt2.tar.gz +md5sum = 76a25c47d0aa01399102c477542a70b5 extra_options = --conf-path=${buildout:directory}/etc/nginx.conf --sbin-path=${buildout:directory}/bin @@ -19,11 +20,22 @@ --with-http_xslt_module --with-libxml2=${buildout:directory}/parts/lxml/libxml2 --with-libxslt=${buildout:directory}/parts/lxml/libxslt -# --with-debug --with-cc-opt="-O0" # helps debugging with gdb + --with-debug --with-cc-opt="-O0" # helps debugging with gdb [nginx-conf] recipe = collective.recipe.template port = 8000 root = ${buildout:directory}/examples +filter-xsl = ${buildout:directory}/lib/xdv/filter.xsl +theme-xsl = ${buildout:directory}/etc/theme.xsl input = ${buildout:directory}/examples/nginx/nginx.conf.in output = ${buildout:directory}/etc/nginx.conf + +[compile-theme] +recipe = plone.recipe.command +command = + ${buildout:directory}/bin/xdvcompiler \ + --includemode=ssi --output=${nginx-conf:theme-xsl} \ + ${nginx-conf:root}/rules.xml ${nginx-conf:root}/theme.html + +update-command = ${compile-theme:command} \ No newline at end of file From ldr at codespeak.net Thu Jan 14 19:34:26 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 14 Jan 2010 19:34:26 +0100 (CET) Subject: [z3-checkins] r70593 - in z3/xdv/trunk: examples/nginx lib/xdv Message-ID: <20100114183426.AAB2316803B@codespeak.net> Author: ldr Date: Thu Jan 14 19:34:26 2010 New Revision: 70593 Modified: z3/xdv/trunk/examples/nginx/nginx.conf.in z3/xdv/trunk/lib/xdv/compiler.py z3/xdv/trunk/lib/xdv/compiler.xsl z3/xdv/trunk/lib/xdv/filter.xsl Log: tweaks to ssi include mode. relative urls are now ok Modified: z3/xdv/trunk/examples/nginx/nginx.conf.in ============================================================================== --- z3/xdv/trunk/examples/nginx/nginx.conf.in (original) +++ z3/xdv/trunk/examples/nginx/nginx.conf.in Thu Jan 14 19:34:26 2010 @@ -8,18 +8,47 @@ http { include ${buildout:directory}/etc/mime.types; # gzip on; - server { listen ${nginx-conf:port}; server_name localhost; root ${nginx-conf:root}; autoindex on; - location = /styled/ { - alias ${nginx-conf:root}; - # don't style the index page, we include it + # Decide if we need to filter + if ($args ~ "^(.*);filter_xpath=(.*)$") { + set $newargs $1; + set $filter_xpath $2; + # rewrite args to avoid looping + rewrite ^(.*)$ /_include$1?$newargs?; } - + + location @include500 { return 500; } + location @include404 { return 404; } + + location ^~ /_include { + # Restrict to subrequests + internal; + error_page 404 = @include404; + + rewrite ^/_include(.*)$ $1 break; + proxy_pass http://127.0.0.1:${nginx-conf:port}; + + # Our safety belt. + proxy_set_header X-Loop 1$http_X_Loop; # unary count + error_page 500 = @include500; + if ($http_X_Loop ~ "11111") { + return 500; + } + + # Filter by xpath + xslt_stylesheet ${nginx-conf:filter-xsl} + xpath=$filter_xpath + ; + xslt_html_parser on; + xslt_types text/html; + } + + location /styled { alias ${nginx-conf:root}; xslt_stylesheet ${nginx-conf:theme-xsl}; @@ -33,26 +62,6 @@ xslt_stylesheet ${nginx-conf:root}/ploneorg/plone.xsl; xslt_html_parser on; xslt_types text/html; - } - - location = /_include_400 { - return 400; - } - - location /_include { - alias ${nginx-conf:root}; - error_page 400 = /_include_400; - if ($arg_content !~ .) { - return 400; - } - -# location ~ ^/_include(.+)$ { -# echo_location_async $1; - xslt_stylesheet ${nginx-conf:filter-xsl} - content=$arg_content - ; - xslt_html_parser on; - xslt_types text/html; - } + } } } Modified: z3/xdv/trunk/lib/xdv/compiler.py ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.py (original) +++ z3/xdv/trunk/lib/xdv/compiler.py Thu Jan 14 19:34:26 2010 @@ -116,7 +116,7 @@ dest="xinclude", default=False) parser.add_option("-i", "--includemode", metavar="INC", help="include mode (document or ssi)", - dest="includemode", default='document') + dest="includemode", default=None) (options, args) = parser.parse_args() if len(args) !=2: Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Thu Jan 14 19:34:26 2010 @@ -10,7 +10,8 @@ document - /_include + + ;filter_xpath= @@ -521,7 +522,8 @@ * $href is an absolute local path (e.g. /foo/bar) --> # include virtual="?content=" + />?" Modified: z3/xdv/trunk/lib/xdv/filter.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/filter.xsl (original) +++ z3/xdv/trunk/lib/xdv/filter.xsl Thu Jan 14 19:34:26 2010 @@ -1,11 +1,11 @@ - - / + + / - - + + WARNING: No content found From ldr at codespeak.net Thu Jan 14 19:39:59 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 14 Jan 2010 19:39:59 +0100 (CET) Subject: [z3-checkins] r70594 - z3/xdv/trunk/examples/nginx Message-ID: <20100114183959.CA07B16803B@codespeak.net> Author: ldr Date: Thu Jan 14 19:39:59 2010 New Revision: 70594 Modified: z3/xdv/trunk/examples/nginx/nginx.conf.in Log: tweaks to ssi include mode. relative urls are now ok Modified: z3/xdv/trunk/examples/nginx/nginx.conf.in ============================================================================== --- z3/xdv/trunk/examples/nginx/nginx.conf.in (original) +++ z3/xdv/trunk/examples/nginx/nginx.conf.in Thu Jan 14 19:39:59 2010 @@ -30,6 +30,7 @@ internal; error_page 404 = @include404; + # Proxy rewrite ^/_include(.*)$ $1 break; proxy_pass http://127.0.0.1:${nginx-conf:port}; @@ -46,22 +47,24 @@ ; xslt_html_parser on; xslt_types text/html; - } - + } + # Our styled location. location /styled { alias ${nginx-conf:root}; xslt_stylesheet ${nginx-conf:theme-xsl}; xslt_html_parser on; xslt_types text/html; + # Switch on ssi here to enable external includes. ssi on; } + # Another styled location. location /styled/ploneorg { alias ${nginx-conf:root}/ploneorg; xslt_stylesheet ${nginx-conf:root}/ploneorg/plone.xsl; xslt_html_parser on; xslt_types text/html; - } + } } } From ldr at codespeak.net Thu Jan 14 22:01:06 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 14 Jan 2010 22:01:06 +0100 (CET) Subject: [z3-checkins] r70597 - z3/xdv/trunk/lib/xdv Message-ID: <20100114210106.EB6C3168048@codespeak.net> Author: ldr Date: Thu Jan 14 22:01:03 2010 New Revision: 70597 Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: improve tracing support to print matching rules Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Thu Jan 14 22:01:03 2010 @@ -186,7 +186,7 @@ before - + @@ -222,7 +222,7 @@ drop - + @@ -534,8 +534,13 @@ + TRACE: - + + RULE: < + =""/> + Author: ldr Date: Thu Jan 14 22:20:36 2010 New Revision: 70598 Modified: z3/xdv/trunk/lib/xdv/cssrules.py Log: error checking for empty css attributes Modified: z3/xdv/trunk/lib/xdv/cssrules.py ============================================================================== --- z3/xdv/trunk/lib/xdv/cssrules.py (original) +++ z3/xdv/trunk/lib/xdv/cssrules.py Thu Jan 14 22:20:36 2010 @@ -17,13 +17,19 @@ import utils +import logging +logger = logging.getLogger('xdv') + def convert_css_selectors(rules, prefix='//'): """Convert css rules to xpath rules element tree in place """ for element in rules.xpath("//@*[namespace-uri()='%s']/.." % utils.namespaces['css']): for name, value in element.attrib.items(): - if name.startswith('{%s}' % utils.namespaces['css']): - element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = css_to_xpath(value, prefix=prefix) + if value: + if name.startswith('{%s}' % utils.namespaces['css']): + element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = css_to_xpath(value, prefix=prefix) + else: + logger.error("Missing value for attribute %s" %name) def main(): """Called from console script From ldr at codespeak.net Sat Jan 23 00:40:37 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Sat, 23 Jan 2010 00:40:37 +0100 (CET) Subject: [z3-checkins] r70787 - z3/xdv/trunk Message-ID: <20100122234037.ABDA116802D@codespeak.net> Author: ldr Date: Sat Jan 23 00:40:34 2010 New Revision: 70787 Modified: z3/xdv/trunk/README.txt z3/xdv/trunk/setup.py Log: prepare 0.3a1 release Modified: z3/xdv/trunk/README.txt ============================================================================== --- z3/xdv/trunk/README.txt (original) +++ z3/xdv/trunk/README.txt Sat Jan 23 00:40:34 2010 @@ -55,6 +55,3 @@ 2) Link rewriting -3) CSS Selector syntax - - Modified: z3/xdv/trunk/setup.py ============================================================================== --- z3/xdv/trunk/setup.py (original) +++ z3/xdv/trunk/setup.py Sat Jan 23 00:40:34 2010 @@ -1,7 +1,12 @@ from setuptools import setup, find_packages setup( name='xdv', - version='0.3', + version='0.3a1', + description='''\ +xdv implements a subset of Deliverance using a pure XSLT engine. With xdv, you +"compile" your theme and ruleset in one step, then use a superfast/simple +transform on each request thereafter. Alternatively, compile your theme during +development, check it into Subversion, and not touch xdv during deployment.''', packages=find_packages('lib'), package_dir = {'':'lib'}, include_package_data=True, From ldr at codespeak.net Sat Jan 23 00:41:44 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Sat, 23 Jan 2010 00:41:44 +0100 (CET) Subject: [z3-checkins] r70788 - z3/xdv/tags Message-ID: <20100122234144.44D53168030@codespeak.net> Author: ldr Date: Sat Jan 23 00:41:43 2010 New Revision: 70788 Added: z3/xdv/tags/ Log: tags directory From ldr at codespeak.net Sat Jan 23 00:42:45 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Sat, 23 Jan 2010 00:42:45 +0100 (CET) Subject: [z3-checkins] r70789 - z3/xdv/tags/0.3a1 Message-ID: <20100122234245.96764168039@codespeak.net> Author: ldr Date: Sat Jan 23 00:42:45 2010 New Revision: 70789 Added: z3/xdv/tags/0.3a1/ - copied from r70788, z3/xdv/trunk/ Log: tag 0.1 From marshall at codespeak.net Thu Jan 28 18:59:50 2010 From: marshall at codespeak.net (marshall at codespeak.net) Date: Thu, 28 Jan 2010 18:59:50 +0100 (CET) Subject: [z3-checkins] r70958 - in z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk: docs dv/xdvserver Message-ID: <20100128175950.08B241680F4@codespeak.net> Author: marshall Date: Thu Jan 28 18:59:50 2010 New Revision: 70958 Modified: z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/docs/HISTORY.txt z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/dv/xdvserver/xdvcompiler.py Log: Added through the web resolving of the rules file. Modified: z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/docs/HISTORY.txt ============================================================================== --- z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/docs/HISTORY.txt (original) +++ z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/docs/HISTORY.txt Thu Jan 28 18:59:50 2010 @@ -7,6 +7,9 @@ * Apply patch from Lukas Zdych to fix absolute prefix. [optilude] +* Added through the web resolving of the rules file. + [Marshall Scorcio] + 1.0b6 - 2009-10-27 ------------------ Modified: z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/dv/xdvserver/xdvcompiler.py ============================================================================== --- z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/dv/xdvserver/xdvcompiler.py (original) +++ z3/deliverance/sandboxes/optilude/dv.xdvserver/trunk/dv/xdvserver/xdvcompiler.py Thu Jan 28 18:59:50 2010 @@ -9,6 +9,14 @@ IMPORT_STYLESHEET_PATTERN = re.compile('@import url\\([\'"](.+)[\'"]\\);', re.I) +class WWWResolver(etree.Resolver): + def resolve(self, system_url, public_id, context): + try: + data = urllib2.urlopen(system_url) + return self.resolve_string(data.read(), context) + except: + pass + def to_absolute(src, prefix): if not (src.startswith('/') or '://' in src): if src.startswith('./'): @@ -22,7 +30,9 @@ """ compiler = open(compiler) - compiler_transform = etree.XSLT(etree.ElementTree(file=compiler)) + compiler_tree = etree.ElementTree(file=compiler) + compiler_tree.parser.resolvers.add(WWWResolver()) + compiler_transform = etree.XSLT(compiler_tree) compiler.close() try: @@ -62,11 +72,12 @@ def prepare_filename(filename): """Make file name string parameters compatible with xdv's compiler.xsl """ - - filename = os.path.abspath(filename) - if sys.platform.startswith('win'): - # compiler.xsl on Windows wants c:/foo/bar instead of C:\foo\bar - filename = filename.replace('\\', '/') + + if not re.match('(http|https|ftp)://', filename.lower()): + filename = os.path.abspath(filename) + if sys.platform.startswith('win'): + # compiler.xsl on Windows wants c:/foo/bar instead of C:\foo\bar + filename = filename.replace('\\', '/') return filename From ldr at codespeak.net Tue Feb 2 23:26:12 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Tue, 2 Feb 2010 23:26:12 +0100 (CET) Subject: [z3-checkins] r71072 - z3/xdv/trunk/lib/xdv Message-ID: <20100202222612.2B0D41683EE@codespeak.net> Author: ldr Date: Tue Feb 2 23:26:11 2010 New Revision: 71072 Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: Seems nginx has trouble with concurrent SSI includes and proxying back on itself Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Tue Feb 2 23:26:11 2010 @@ -523,7 +523,7 @@ --> # include virtual="?" + >" wait="yes" From optilude at codespeak.net Sun Feb 7 13:12:49 2010 From: optilude at codespeak.net (optilude at codespeak.net) Date: Sun, 7 Feb 2010 13:12:49 +0100 (CET) Subject: [z3-checkins] r71146 - in z3/xdv/trunk: . lib lib/xdv lib/xdv/tests lib/xdv/tests/absolute Message-ID: <20100207121249.1A3E3282BD5@codespeak.net> Author: optilude Date: Sun Feb 7 13:12:48 2010 New Revision: 71146 Added: z3/xdv/trunk/lib/xdv/tests/absolute/ z3/xdv/trunk/lib/xdv/tests/absolute/rules.xml z3/xdv/trunk/lib/xdv/tests/absolute/theme.html Modified: z3/xdv/trunk/README.txt z3/xdv/trunk/lib/ (props changed) z3/xdv/trunk/lib/xdv/compiler.py z3/xdv/trunk/lib/xdv/tests/tests.py Log: Add absolute_prefix option from dv.xdvserver Modified: z3/xdv/trunk/README.txt ============================================================================== --- z3/xdv/trunk/README.txt (original) +++ z3/xdv/trunk/README.txt Sun Feb 7 13:12:48 2010 @@ -11,7 +11,7 @@ Usage ---------------- -1) Edit the ``theme.html``, ``rules.xml``, and ``content.html``. +1) Create the files ``theme.html``, ``rules.xml``, and ``content.html``. 2) xsltproc --html compiler.xsl theme.html > compiledtheme.xsl Modified: z3/xdv/trunk/lib/xdv/compiler.py ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.py (original) +++ z3/xdv/trunk/lib/xdv/compiler.py Sun Feb 7 13:12:48 2010 @@ -11,19 +11,22 @@ """ usage = __doc__ +import re import os.path import sys import logging from lxml import etree from optparse import OptionParser -from utils import namespaces, localname, fullname +from utils import namespaces from cssrules import convert_css_selectors logger = logging.getLogger('xdv') HERE = os.path.dirname(__file__) +IMPORT_STYLESHEET_PATTERN = '@import url\\([\'"](.+)[\'"]\\);' + COMPILER_PATH = os.path.join(HERE, 'compiler.xsl') UPDATE_PATH = os.path.join(HERE, 'update-namespace.xsl') @@ -49,9 +52,48 @@ if url == 'xdv:extra' and self.extra is not None: return self.resolve_string(self.extra, context) +def to_absolute(src, prefix): + """Turn a url + """ + if src.startswith('/') or '://' in src: + return src + + if src.startswith('./'): + return "%s/%s" % (prefix, src[2:]) + else: + return "%s/%s" % (prefix, src) -def compile_theme(rules, theme, extra=None, css=True, xinclude=False, update=True, trace=False, includemode=None, parser=None, compiler_parser=None): - """Invoke the xdv compiler +def apply_absolute_prefix(theme_doc, absolute_prefix): + for node in theme_doc.xpath('*//style | *//script | *//img | *//link'): + if node.tag == 'img' or node.tag == 'script': + src = node.get('src') + if src: + node.set('src', to_absolute(src, absolute_prefix)) + elif node.tag == 'link': + href = node.get('href') + if href: + node.set('href', to_absolute(href, absolute_prefix)) + elif node.tag == 'style': + node.text = re.sub(IMPORT_STYLESHEET_PATTERN, r'@import url("%s/\1");' % absolute_prefix, node.text, re.I) + +def compile_theme(rules, theme, extra=None, css=True, xinclude=False, absolute_prefix=None, update=True, trace=False, includemode=None, parser=None, compiler_parser=None): + """Invoke the xdv compiler. + + * ``rules`` is the rules file + * ``theme`` is the theme file + * ``extra`` is an optional XSLT file with XDV extensions + * ``css`` can be set to False to disable CSS syntax support (providing a + moderate speed gain) + * ``xinclude`` can be set to True to enable XInclude support (at a + moderate speed cost) + * ``update`` can be set to False to disable the automatic update support for + the old Deliverance 0.2 namespace (for a moderate speed gain) + * ``trace`` can be set to True to enable compiler trace information + * ``includemode`` can be set to 'document' or 'ssi' to change the way in + which includes are processed + * ``parser`` can be set to an lxml parser class; the default is HTMLParser + * ``compiler_parser``` can be set to an lxml parser class; the default is + XMLParser """ rules_doc = etree.parse(rules) if xinclude: @@ -65,6 +107,9 @@ parser = etree.HTMLParser() theme_doc = etree.parse(theme, parser=parser) + if absolute_prefix: + apply_absolute_prefix(theme_doc, absolute_prefix) + if compiler_parser is None: compiler_parser = etree.XMLParser() compiler_transform = etree.XSLT(etree.parse(COMPILER_PATH, parser=compiler_parser)) Added: z3/xdv/trunk/lib/xdv/tests/absolute/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/absolute/rules.xml Sun Feb 7 13:12:48 2010 @@ -0,0 +1,4 @@ + + + + Added: z3/xdv/trunk/lib/xdv/tests/absolute/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/absolute/theme.html Sun Feb 7 13:12:48 2010 @@ -0,0 +1,36 @@ + + + + Absolute prefix + + + + + + + + + + \ No newline at end of file + + + + Second Theme Page Title + + + + + + Modified: z3/xdv/trunk/lib/xdv/tests/003/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/003/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/003/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/004/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/004/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/004/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/004/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/004/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/004/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,11 @@ -Second Theme Page Title \ No newline at end of file + + + + + Second Theme Page Title + + + + + Modified: z3/xdv/trunk/lib/xdv/tests/004/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/004/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/004/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/005/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/005/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/005/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -33,7 +33,7 @@ Second Theme Page Title -
Some stuff
+
Modified: z3/xdv/trunk/lib/xdv/tests/005/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/005/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/005/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,13 @@ -Second Theme Page Title

A Deeper Look....at...xdv

And some content.

\ No newline at end of file + + + + Second Theme Page Title + + +
+

A Deeper Look....at...xdv

+

And some content.

+
+ + Modified: z3/xdv/trunk/lib/xdv/tests/005/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/005/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/005/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/006/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/006/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/006/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/006/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/006/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/006/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,12 @@ -Second Theme Page Title \ No newline at end of file + + + + + Second Theme Page Title + + + + + + Modified: z3/xdv/trunk/lib/xdv/tests/006/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/006/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/006/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/007/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/007/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/007/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/007/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/007/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/007/output.html Mon Feb 8 18:06:46 2010 @@ -1,4 +1,14 @@ -Ninth Theme Page Title \ No newline at end of file + + + + + Modified: z3/xdv/trunk/lib/xdv/tests/007/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/007/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/007/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/008/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/008/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/008/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -32,9 +32,7 @@ - Second Theme Page Title -

blah

-
+
Modified: z3/xdv/trunk/lib/xdv/tests/008/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/008/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/008/output.html Mon Feb 8 18:06:46 2010 @@ -1,6 +1,14 @@ -A Deeper Look At xdv
+ + + + A Deeper Look At xdv + + +

boo bar baz

-
\ No newline at end of file +
+ + Modified: z3/xdv/trunk/lib/xdv/tests/008/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/008/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/008/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/009/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/009/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/009/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -39,7 +39,7 @@ var x = '<div>';

Title

-
+
Modified: z3/xdv/trunk/lib/xdv/tests/009/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/009/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/009/output.html Mon Feb 8 18:06:46 2010 @@ -1,12 +1,27 @@ -Theme Title

Title

Some text

\ No newline at end of file + + + Modified: z3/xdv/trunk/lib/xdv/tests/009/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/009/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/009/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -34,11 +34,11 @@ Theming with portlets
-
+
Portlet
- + Modified: z3/xdv/trunk/lib/xdv/tests/010/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/010/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/010/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,20 @@ -Theming with portlets
AAA

Portlets

Portlet A
Portlet A
Manage Portlets
BBB
\ No newline at end of file + + + + Theming with portlets + + +
AAA
+
+

Portlets

+
+
Portlet A
+
Portlet A
+
+ Manage Portlets +
+
BBB
+ + + Modified: z3/xdv/trunk/lib/xdv/tests/010/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/010/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/010/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -34,9 +34,7 @@ Theming with portlets
-
-
Portlet
-
+
Modified: z3/xdv/trunk/lib/xdv/tests/011/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/011/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/011/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,8 @@ -Theming with portlets \ No newline at end of file + + + + Theming with portlets + + + Modified: z3/xdv/trunk/lib/xdv/tests/011/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/011/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/011/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -33,7 +33,7 @@ Replace and after -

Title

+
Modified: z3/xdv/trunk/lib/xdv/tests/012/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/012/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/012/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,12 @@ -Replace and after

Smaller Title

content

\ No newline at end of file + + + + Replace and after + + +

Smaller Title

+

content

+ + + Modified: z3/xdv/trunk/lib/xdv/tests/012/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/012/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/012/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -1,4 +1,4 @@ - + @@ -33,8 +33,8 @@ External includes -
Marker
-
Marker
+ +
Modified: z3/xdv/trunk/lib/xdv/tests/013/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/013/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/013/output.html Mon Feb 8 18:06:46 2010 @@ -1,14 +1,32 @@ -External includes
+ + + + External includes + + +
ONE -
+
+
TWO -
+
+
THREE -
+
+
+
FOUR -
+
+
FIVE -
+
+
SIX -

Smaller Title

content

\ No newline at end of file +
+
+

Smaller Title

+

content

+ + + Modified: z3/xdv/trunk/lib/xdv/tests/013/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/013/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/013/rules.xml Mon Feb 8 18:06:46 2010 @@ -1,5 +1,5 @@ - + Added: z3/xdv/trunk/lib/xdv/tests/014/compiled.xsl ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/014/compiled.xsl Mon Feb 8 18:06:46 2010 @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Third Marker +
  • first
  • +
  • second
  • +
  • +
  • fourth
  • +
+
Third Marker
+
Fourth marker
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file Modified: z3/xdv/trunk/lib/xdv/tests/014/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/014/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/014/output.html Mon Feb 8 18:06:46 2010 @@ -1,2 +1,25 @@ -Pseudo classes and complex selectors
Someting very great from last content's DIV
Third Marker
  • first
  • second
  • new item from content
  • fourth
Third Marker
Fourth marker
\ No newline at end of file + + + + Pseudo classes and complex selectors + + +
+
Someting very great from last content's DIV
+
+
+ Third Marker +
    +
  • first
  • +
  • second
  • +
  • + new item from content +
  • +
  • fourth
  • +
+
+
Third Marker
+
Fourth marker
+ + Modified: z3/xdv/trunk/lib/xdv/tests/tests.py ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/tests.py (original) +++ z3/xdv/trunk/lib/xdv/tests/tests.py Mon Feb 8 18:06:46 2010 @@ -20,7 +20,8 @@ HERE = os.path.abspath(os.path.dirname(__file__)) class XDVTestCase(unittest.TestCase): - writefiles = False + + writefiles = os.environ.get('XDVTESTS_WRITE_FILES', False) testdir = None # override @@ -33,13 +34,6 @@ xslfn = os.path.join(self.testdir, "compiled.xsl") outputfn = os.path.join(self.testdir, "output.html") - if (not os.path.exists(themefn) or - not os.path.exists(contentfn) or - not os.path.exists(rulesfn) or - not os.path.exists(outputfn) - ): - return - contentdoc = etree.parse(source=contentfn, base_url=contentfn, parser=etree.HTMLParser()) @@ -57,11 +51,11 @@ old = open(xslfn).read() new = cts if old != new: - print >>self.errors, "WARNING:", "compiled.xsl has CHANGED" - for line in difflib.unified_diff(old.split('\n'), new.split('\n'), xslfn, 'now'): - print >>self.errors, line if self.writefiles: open(xslfn + '.old', 'w').write(old) + print "WARNING:", "compiled.xsl has CHANGED" + for line in difflib.unified_diff(old.split('\n'), new.split('\n'), xslfn, 'now'): + print line # Write the compiled xsl out to catch unexpected changes if self.writefiles: @@ -73,37 +67,38 @@ result = processor(contentdoc) # Read the whole thing to strip off xhtml namespace. # If we had xslt 2.0 then we could use xpath-default-namespace. - self.themed_string = etree.tostring(result) + self.themed_string = etree.tostring(result, pretty_print=True) self.themed_content = etree.ElementTree(file=StringIO(self.themed_string), parser=etree.HTMLParser()) # remove the extra meta content type + meta = self.themed_content.xpath("/html/head/meta[@http-equiv='Content-Type']")[0] meta.getparent().remove(meta) if os.path.exists(xpathsfn): - # xp = "/html/head/*[position()='1']/@id" for xpath in open(xpathsfn).readlines(): # Read the XPaths from the file, skipping blank lines and # comments this_xpath = xpath.strip() if not this_xpath or this_xpath[0] == '#': continue - if not self.themed_content.xpath(this_xpath): - print >>self.errors, "FAIL:", this_xpath, "is FALSE" + assert self.themed_content.xpath(this_xpath), "%s: %s" % (xpathsfn, this_xpath) # Compare to previous version if os.path.exists(outputfn): old = open(outputfn).read() new = self.themed_string if old != new: - print >>self.errors, "FAIL:", "output.html has CHANGED" - for line in difflib.unified_diff(old.split('\n'), new.split('\n'), outputfn, 'now'): - print >>self.errors, line + import pdb; pdb.set_trace() if self.writefiles: open(outputfn + '.old', 'w').write(old) + print "ERROR:", "output.html has CHANGED" + for line in difflib.unified_diff(old.split('\n'), new.split('\n'), outputfn, 'now'): + print line + self.assertEquals(old, new) - # Write the compiled xsl out to catch unexpected changes + # Write out the result to catch unexpected changes if self.writefiles: open(outputfn, 'w').write(self.themed_string) @@ -200,35 +195,7 @@ '/foo.jpg', 'http://site.com/foo.jpg' ], [x.get('src') for x in imgTags]) - - -def main(*args, **kwargs): - try: - test_num = sys.argv[1] - except IndexError: - test_num = 1 - errors = 0 - while True: - directory = os.path.join(HERE, '%03d' % test_num) - if not os.path.isdir(directory): - test_num -= 1 - break - xdv = XDV(directory, *args, **kwargs) - result = xdv.errors.getvalue() - if result: - print 'Error running test %s...' % directory - print result - errors += 1 - test_num += 1 - print "Ran %s tests with %s errors." % (test_num, errors) - else: - test_dir = os.path.abspath(test_num) - xdv = XDV(test_dir, *args, **kwargs) - print xdv.themed_string - errors = xdv.errors.getvalue() - if errors: - print - print xdv.errors.getvalue() + def test_suite(): suite = unittest.TestSuite() @@ -242,18 +209,3 @@ suite.addTest(unittest.makeSuite(cls)) suite.addTest(unittest.makeSuite(TestAbsolutePrefix)) return suite - -if __name__ == "__main__": - debug = '--debug' in sys.argv - if debug: - sys.argv.remove('--debug') - writefiles = '--writefiles' in sys.argv - if writefiles: - sys.argv.remove('--writefiles') - try: - main(debug=debug, writefiles=writefiles) - except: - type, value, tb = sys.exc_info() - traceback.print_exc() - if debug: - pdb.post_mortem(tb) From ldr at codespeak.net Mon Feb 8 18:39:48 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Mon, 8 Feb 2010 18:39:48 +0100 (CET) Subject: [z3-checkins] r71174 - in z3/xdv/trunk/lib/xdv: . tests tests/update-namespace Message-ID: <20100208173948.EEA34282BDA@codespeak.net> Author: ldr Date: Mon Feb 8 18:39:41 2010 New Revision: 71174 Added: z3/xdv/trunk/lib/xdv/tests/update-namespace/ z3/xdv/trunk/lib/xdv/tests/update-namespace/content.html z3/xdv/trunk/lib/xdv/tests/update-namespace/rules.xml z3/xdv/trunk/lib/xdv/tests/update-namespace/theme.html z3/xdv/trunk/lib/xdv/tests/update-namespace/xpaths.txt Modified: z3/xdv/trunk/lib/xdv/tests/tests.py z3/xdv/trunk/lib/xdv/update-namespace.xsl Log: add a test for the updating of namespace and nocontent Modified: z3/xdv/trunk/lib/xdv/tests/tests.py ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/tests.py (original) +++ z3/xdv/trunk/lib/xdv/tests/tests.py Mon Feb 8 18:39:41 2010 @@ -73,8 +73,10 @@ # remove the extra meta content type - meta = self.themed_content.xpath("/html/head/meta[@http-equiv='Content-Type']")[0] - meta.getparent().remove(meta) + metas = self.themed_content.xpath("/html/head/meta[@http-equiv='Content-Type']") + if metas: + meta = metas[0] + meta.getparent().remove(meta) if os.path.exists(xpathsfn): for xpath in open(xpathsfn).readlines(): Added: z3/xdv/trunk/lib/xdv/tests/update-namespace/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/update-namespace/content.html Mon Feb 8 18:39:41 2010 @@ -0,0 +1,6 @@ + + +
content
+
portlet
+ + Added: z3/xdv/trunk/lib/xdv/tests/update-namespace/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/update-namespace/rules.xml Mon Feb 8 18:39:41 2010 @@ -0,0 +1,9 @@ + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/update-namespace/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/update-namespace/theme.html Mon Feb 8 18:39:41 2010 @@ -0,0 +1,13 @@ + + + +

theme

+
Blah +
core
+
+

theme

+
+
wrapper
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/update-namespace/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/update-namespace/xpaths.txt Mon Feb 8 18:39:41 2010 @@ -0,0 +1,7 @@ +# In this test we check that rule files using the old namespace +# get behaviour equivalent to nocontent="theme" + +/html/body/h1[contains(., 'theme')] +/html/body/div/div[@class="content"] +/html/body/h2[contains(., 'theme')] +/html/body/div/div/div[@class="content"] Modified: z3/xdv/trunk/lib/xdv/update-namespace.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/update-namespace.xsl (original) +++ z3/xdv/trunk/lib/xdv/update-namespace.xsl Mon Feb 8 18:39:41 2010 @@ -9,7 +9,7 @@ - + From ejucovy at codespeak.net Mon Feb 8 20:11:23 2010 From: ejucovy at codespeak.net (ejucovy at codespeak.net) Date: Mon, 8 Feb 2010 20:11:23 +0100 (CET) Subject: [z3-checkins] r71175 - in z3/deliverance/trunk/deliverance: . tests Message-ID: <20100208191123.E5755282BD9@codespeak.net> Author: ejucovy Date: Mon Feb 8 20:11:20 2010 New Revision: 71175 Modified: z3/deliverance/trunk/deliverance/rules.py z3/deliverance/trunk/deliverance/tests/test_middleware.txt Log: wip #6 request/response matching broken: * return RuleMatch instance in RuleMatch factory, not rule (now rule matches fail silenty instead of 'not callable' error) * add failing test Modified: z3/deliverance/trunk/deliverance/rules.py ============================================================================== --- z3/deliverance/trunk/deliverance/rules.py (original) +++ z3/deliverance/trunk/deliverance/rules.py Mon Feb 8 20:11:20 2010 @@ -93,7 +93,7 @@ """ inst = cls(**cls.parse_match_xml(el, source_location)) inst.rule = rule - return rule + return inst def debug_description(self): """Used by AbstractMatch for logging""" Modified: z3/deliverance/trunk/deliverance/tests/test_middleware.txt ============================================================================== --- z3/deliverance/trunk/deliverance/tests/test_middleware.txt (original) +++ z3/deliverance/trunk/deliverance/tests/test_middleware.txt Mon Feb 8 20:11:20 2010 @@ -66,6 +66,9 @@ ... ... ... + ... + ... + ... ... ''' Rule files can be published and fetched with a subrequest: @@ -106,6 +109,10 @@ >>> app['/magic'].headers['x-no-deliverate'] = '1' >>> app['/magic2'] = Response('''\ ... something''') + >>> app['/foo'] = Response('''\ + ... + ...
Good!
+ ...
Bad.
''') We'll set up one DeliveranceMiddleware using the published rules, and another using the rule file: @@ -467,3 +474,33 @@ '' >>> tostring(fromstring(x), include_meta_content_type=True) '' + +Test that rule matches work: + + >>> print compare_request('/foo', deliv_filename) # doctest: +REPORT_UDIFF + Original content: + +
Good!
+
Bad.
+ Themed content: + + This is a theme title + + +
+ +
+
Good!
+ Back to top +
+ + + + From optilude at codespeak.net Tue Feb 9 10:06:28 2010 From: optilude at codespeak.net (optilude at codespeak.net) Date: Tue, 9 Feb 2010 10:06:28 +0100 (CET) Subject: [z3-checkins] r71177 - in z3/xdv/trunk/lib/xdv: . tests Message-ID: <20100209090628.102CC282BDE@codespeak.net> Author: optilude Date: Tue Feb 9 10:06:27 2010 New Revision: 71177 Modified: z3/xdv/trunk/lib/xdv/compiler.py z3/xdv/trunk/lib/xdv/tests/absolute_theme.html z3/xdv/trunk/lib/xdv/tests/tests.py Log: Add support for absolute prefix for Modified: z3/xdv/trunk/lib/xdv/compiler.py ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.py (original) +++ z3/xdv/trunk/lib/xdv/compiler.py Tue Feb 9 10:06:27 2010 @@ -65,8 +65,8 @@ def apply_absolute_prefix(theme_doc, absolute_prefix): if absolute_prefix.endswith('/'): absolute_prefix = absolute_prefix[:-1] - for node in theme_doc.xpath('*//style | *//script | *//img | *//link | *//comment()'): - if node.tag == 'img' or node.tag == 'script': + for node in theme_doc.xpath('*//style | *//script | *//img | *//link | *//input | *//comment() '): + if node.tag in ('img', 'script', 'input',): src = node.get('src') if src: node.set('src', to_absolute(src, absolute_prefix)) Modified: z3/xdv/trunk/lib/xdv/tests/absolute_theme.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/absolute_theme.html (original) +++ z3/xdv/trunk/lib/xdv/tests/absolute_theme.html Tue Feb 9 10:06:27 2010 @@ -32,6 +32,13 @@ + + + + + + Link + Modified: z3/xdv/trunk/lib/xdv/tests/tests.py ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/tests.py (original) +++ z3/xdv/trunk/lib/xdv/tests/tests.py Tue Feb 9 10:06:27 2010 @@ -6,7 +6,6 @@ import os import sys import traceback -import pdb import difflib from StringIO import StringIO import unittest @@ -92,7 +91,6 @@ old = open(outputfn).read() new = self.themed_string if old != new: - import pdb; pdb.set_trace() if self.writefiles: open(outputfn + '.old', 'w').write(old) print "ERROR:", "output.html has CHANGED" @@ -151,6 +149,15 @@ '/foo.jpg', 'http://site.com/foo.jpg' ], [x.get('src') for x in imgTags]) + + inputTags = compiled.xpath('//input') + self.assertEquals([ + '/abs/foo.jpg', + '/abs/foo.jpg', + '/abs/../foo.jpg', + '/foo.jpg', + 'http://site.com/foo.jpg' + ], [x.get('src') for x in inputTags]) def testDisabled(self): themefn = os.path.join(HERE, "absolute_theme.html") @@ -197,6 +204,15 @@ '/foo.jpg', 'http://site.com/foo.jpg' ], [x.get('src') for x in imgTags]) + + inputTags = compiled.xpath('//input') + self.assertEquals([ + 'foo.jpg', + './foo.jpg', + '../foo.jpg', + '/foo.jpg', + 'http://site.com/foo.jpg' + ], [x.get('src') for x in inputTags]) def test_suite(): From ldr at codespeak.net Tue Feb 9 14:48:53 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Tue, 9 Feb 2010 14:48:53 +0100 (CET) Subject: [z3-checkins] r71178 - in z3/xdv/trunk/lib/xdv: . tests/multi-copy-1 tests/multi-copy-2 tests/multi-copy-3 tests/multi-copy-4 tests/multi-replace-1 tests/multi-replace-2 tests/multi-replace-3 tests/multi-replace-4 Message-ID: <20100209134853.46F3B282BE3@codespeak.net> Author: ldr Date: Tue Feb 9 14:48:51 2010 New Revision: 71178 Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-1/ z3/xdv/trunk/lib/xdv/tests/multi-copy-1/content.html z3/xdv/trunk/lib/xdv/tests/multi-copy-1/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-copy-1/theme.html z3/xdv/trunk/lib/xdv/tests/multi-copy-1/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-copy-2/ z3/xdv/trunk/lib/xdv/tests/multi-copy-2/content.html z3/xdv/trunk/lib/xdv/tests/multi-copy-2/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-copy-2/theme.html z3/xdv/trunk/lib/xdv/tests/multi-copy-2/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-copy-3/ z3/xdv/trunk/lib/xdv/tests/multi-copy-3/content.html z3/xdv/trunk/lib/xdv/tests/multi-copy-3/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-copy-3/theme.html z3/xdv/trunk/lib/xdv/tests/multi-copy-3/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-copy-4/ z3/xdv/trunk/lib/xdv/tests/multi-copy-4/content.html z3/xdv/trunk/lib/xdv/tests/multi-copy-4/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-copy-4/theme.html z3/xdv/trunk/lib/xdv/tests/multi-copy-4/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-replace-1/ z3/xdv/trunk/lib/xdv/tests/multi-replace-1/content.html z3/xdv/trunk/lib/xdv/tests/multi-replace-1/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-replace-1/theme.html z3/xdv/trunk/lib/xdv/tests/multi-replace-1/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-replace-2/ z3/xdv/trunk/lib/xdv/tests/multi-replace-2/content.html z3/xdv/trunk/lib/xdv/tests/multi-replace-2/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-replace-2/theme.html z3/xdv/trunk/lib/xdv/tests/multi-replace-2/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-replace-3/ z3/xdv/trunk/lib/xdv/tests/multi-replace-3/content.html z3/xdv/trunk/lib/xdv/tests/multi-replace-3/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-replace-3/theme.html z3/xdv/trunk/lib/xdv/tests/multi-replace-3/xpaths.txt z3/xdv/trunk/lib/xdv/tests/multi-replace-4/ z3/xdv/trunk/lib/xdv/tests/multi-replace-4/content.html z3/xdv/trunk/lib/xdv/tests/multi-replace-4/rules.xml z3/xdv/trunk/lib/xdv/tests/multi-replace-4/theme.html z3/xdv/trunk/lib/xdv/tests/multi-replace-4/xpaths.txt Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: multiple copy and replace support Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Tue Feb 9 14:48:51 2010 @@ -266,46 +266,69 @@ - + + + - ERROR: Multiple replace rules may not match a single theme node. + ERROR: Multiple unconditional replace rules may not match a single theme node. - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + @@ -341,45 +364,58 @@ - + + + - ERROR: Multiple copy rules may not match a single theme node. + ERROR: Multiple unconditional copy rules may not match a single theme node. + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + + - - - - - - - - - - + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-1/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-1/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,14 @@ + + + Page title + + +

content title

+
content description
+
+

first heading

+
content description2
+
content description3
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-1/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-1/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,12 @@ + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-1/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-1/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-1/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-1/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check the first branches + +/html/body/h1[contains(., 'content title')] +/html/body/div[contains(., 'content description')] Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-2/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-2/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,12 @@ + + + Page title + + +
+

first heading

+
content description2
+
content description3
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-2/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-2/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,12 @@ + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-2/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-2/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-2/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-2/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check the second branches + +/html/body/h1[contains(., 'first heading')] +/html/body/div[contains(., 'content description2')] Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-3/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-3/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,10 @@ + + + Page title + + +
+
content description3
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-3/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-3/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,12 @@ + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-3/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-3/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-3/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-3/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check the third branches + +/html/body/h1[contains(., 'Page title')] +/html/body/div[contains(., 'content description3')] Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-4/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-4/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,8 @@ + + + + +
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-4/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-4/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,12 @@ + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-4/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-4/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-copy-4/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-copy-4/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,5 @@ +# Check when nothing matches + +/html/body/h1[contains(., 'theme')] +/html/body/div +not(/html/body/div/text()) Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-1/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-1/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,14 @@ + + + Page title + + +

content title

+
content description
+
+

first heading

+
content description2
+
content description3
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-1/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-1/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-1/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-1/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-1/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-1/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check the first branches + +/html/body/h1[contains(., 'content title')] +/html/body/div[contains(., 'content description')] Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-2/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-2/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,12 @@ + + + Page title + + +
+

first heading

+
content description2
+
content description3
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-2/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-2/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-2/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-2/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-2/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-2/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check the second branches + +/html/body/h1[contains(., 'first heading')] +/html/body/div[contains(., 'content description2')] Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-3/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-3/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,10 @@ + + + Page title + + +
+
content description3
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-3/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-3/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-3/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-3/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-3/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-3/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check the third branches + +/html/body/h1[contains(., 'Page title')] +/html/body/div[contains(., 'content description3')] Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-4/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-4/content.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,8 @@ + + + + +
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-4/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-4/rules.xml Tue Feb 9 14:48:51 2010 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-4/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-4/theme.html Tue Feb 9 14:48:51 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/multi-replace-4/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/multi-replace-4/xpaths.txt Tue Feb 9 14:48:51 2010 @@ -0,0 +1,4 @@ +# Check when nothing matches + +/html/body/h1[contains(., 'theme')] +not(/html/body/div) From ldr at codespeak.net Tue Feb 9 17:34:48 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Tue, 9 Feb 2010 17:34:48 +0100 (CET) Subject: [z3-checkins] r71179 - in z3/xdv/trunk/lib/xdv: . tests/012 tests/null-if-content Message-ID: <20100209163448.8EC7E282BDF@codespeak.net> Author: ldr Date: Tue Feb 9 17:34:46 2010 New Revision: 71179 Added: z3/xdv/trunk/lib/xdv/tests/null-if-content/ z3/xdv/trunk/lib/xdv/tests/null-if-content/content.html z3/xdv/trunk/lib/xdv/tests/null-if-content/rules.xml z3/xdv/trunk/lib/xdv/tests/null-if-content/theme.html z3/xdv/trunk/lib/xdv/tests/null-if-content/xpaths.txt Modified: z3/xdv/trunk/lib/xdv/compiler.xsl z3/xdv/trunk/lib/xdv/cssrules.py z3/xdv/trunk/lib/xdv/tests/012/rules.xml z3/xdv/trunk/lib/xdv/tests/012/xpaths.txt Log: add if-content='' as a shortcut Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Tue Feb 9 17:34:46 2010 @@ -107,7 +107,15 @@ r - + + + + + + + + + Modified: z3/xdv/trunk/lib/xdv/cssrules.py ============================================================================== --- z3/xdv/trunk/lib/xdv/cssrules.py (original) +++ z3/xdv/trunk/lib/xdv/cssrules.py Tue Feb 9 17:34:46 2010 @@ -29,7 +29,7 @@ if name.startswith('{%s}' % utils.namespaces['css']): element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = css_to_xpath(value, prefix=prefix) else: - logger.error("Missing value for attribute %s" %name) + element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = "" def main(): """Called from console script Modified: z3/xdv/trunk/lib/xdv/tests/012/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/012/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/012/rules.xml Tue Feb 9 17:34:46 2010 @@ -2,6 +2,6 @@ - + Modified: z3/xdv/trunk/lib/xdv/tests/012/xpaths.txt ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/012/xpaths.txt (original) +++ z3/xdv/trunk/lib/xdv/tests/012/xpaths.txt Tue Feb 9 17:34:46 2010 @@ -1,5 +1,5 @@ # -# Conditional . The entire portlet-wrapper should be dropped when the +# unconditional . The entire portlet-wrapper should be dropped when the # content is empty. This time there are no portlets. # /html/body/h2 Added: z3/xdv/trunk/lib/xdv/tests/null-if-content/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/null-if-content/content.html Tue Feb 9 17:34:46 2010 @@ -0,0 +1,3 @@ +
+

Some text

+
Added: z3/xdv/trunk/lib/xdv/tests/null-if-content/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/null-if-content/rules.xml Tue Feb 9 17:34:46 2010 @@ -0,0 +1,7 @@ + + + + + + Added: z3/xdv/trunk/lib/xdv/tests/null-if-content/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/null-if-content/theme.html Tue Feb 9 17:34:46 2010 @@ -0,0 +1,8 @@ + + + +

theme

+
theme description
+
theme description
+ + Added: z3/xdv/trunk/lib/xdv/tests/null-if-content/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/null-if-content/xpaths.txt Tue Feb 9 17:34:46 2010 @@ -0,0 +1,4 @@ +# Check that content="xpath " if-content="" works the same as content="xpath " if-content="xpath" + +//div[@id = "marker1"]/p +//div[@id = "marker2"]/p From ejucovy at codespeak.net Tue Feb 9 23:21:13 2010 From: ejucovy at codespeak.net (ejucovy at codespeak.net) Date: Tue, 9 Feb 2010 23:21:13 +0100 (CET) Subject: [z3-checkins] r71182 - z3/deliverance/trunk/deliverance/tests Message-ID: <20100209222113.03CA8282BDF@codespeak.net> Author: ejucovy Date: Tue Feb 9 23:21:10 2010 New Revision: 71182 Modified: z3/deliverance/trunk/deliverance/tests/test_middleware.txt Log: turns out the test was broken -- the drop has to be before the replace, since it's removed from the content doc (to be put in the theme) in the replace. fixes #6 Modified: z3/deliverance/trunk/deliverance/tests/test_middleware.txt ============================================================================== --- z3/deliverance/trunk/deliverance/tests/test_middleware.txt (original) +++ z3/deliverance/trunk/deliverance/tests/test_middleware.txt Tue Feb 9 23:21:10 2010 @@ -52,6 +52,9 @@ ... ... ... + ... + ... + ... ... ... ... @@ -66,9 +69,6 @@ ... ... ... - ... - ... - ... ... ''' Rule files can be published and fetched with a subrequest: @@ -275,6 +275,9 @@ ... ... ... + ... + ... + ... ... ... ... @@ -496,6 +499,7 @@
Good!
+
Back to top From ldr at codespeak.net Tue Feb 9 23:25:49 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Tue, 9 Feb 2010 23:25:49 +0100 (CET) Subject: [z3-checkins] r71183 - z3/xdv/trunk/lib/xdv Message-ID: <20100209222549.97971282BDF@codespeak.net> Author: ldr Date: Tue Feb 9 23:25:48 2010 New Revision: 71183 Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: Allow xdv rules to be in a prefixed namespace Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Tue Feb 9 23:25:48 2010 @@ -197,7 +197,7 @@ before - + @@ -213,7 +213,7 @@ drop - + @@ -270,7 +270,7 @@ replace - + @@ -357,7 +357,7 @@ prepend-copy-append - + @@ -369,11 +369,11 @@ - + - - + + ERROR: Multiple unconditional copy rules may not match a single theme node. @@ -433,7 +433,7 @@ - +
@@ -453,7 +453,7 @@ after - + From ldr at codespeak.net Wed Feb 10 00:19:53 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 10 Feb 2010 00:19:53 +0100 (CET) Subject: [z3-checkins] r71184 - z3/xdv/trunk/lib/xdv Message-ID: <20100209231953.3D7D2282BDF@codespeak.net> Author: ldr Date: Wed Feb 10 00:19:51 2010 New Revision: 71184 Modified: z3/xdv/trunk/lib/xdv/cssrules.py Log: attributes should be put in the default namespace Modified: z3/xdv/trunk/lib/xdv/cssrules.py ============================================================================== --- z3/xdv/trunk/lib/xdv/cssrules.py (original) +++ z3/xdv/trunk/lib/xdv/cssrules.py Wed Feb 10 00:19:51 2010 @@ -27,7 +27,7 @@ for name, value in element.attrib.items(): if value: if name.startswith('{%s}' % utils.namespaces['css']): - element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = css_to_xpath(value, prefix=prefix) + element.attrib[utils.localname(name)] = css_to_xpath(value, prefix=prefix) else: element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = "" From ldr at codespeak.net Wed Feb 10 00:20:54 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 10 Feb 2010 00:20:54 +0100 (CET) Subject: [z3-checkins] r71185 - in z3/xdv/trunk/lib/xdv: . tests/modify-theme Message-ID: <20100209232054.57288282BDF@codespeak.net> Author: ldr Date: Wed Feb 10 00:20:52 2010 New Revision: 71185 Added: z3/xdv/trunk/lib/xdv/tests/modify-theme/ z3/xdv/trunk/lib/xdv/tests/modify-theme/content.html z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html z3/xdv/trunk/lib/xdv/tests/modify-theme/xpaths.txt Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: Synthetic content. A better way of including xsl. Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Wed Feb 10 00:20:52 2010 @@ -116,6 +116,9 @@
+ + + @@ -294,8 +297,7 @@ - - + @@ -310,8 +312,7 @@ - - + @@ -335,8 +336,7 @@ - - + @@ -393,8 +393,7 @@ - - + @@ -403,8 +402,7 @@ - - + @@ -421,8 +419,7 @@ - - + @@ -481,24 +478,31 @@ - - + - - +
- - + + + + + + + ERROR: @content and synthetic + + + + Added: z3/xdv/trunk/lib/xdv/tests/modify-theme/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/content.html Wed Feb 10 00:20:52 2010 @@ -0,0 +1,14 @@ + + + + + + + + + + + +
One1
Two2
+ + Added: z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html Wed Feb 10 00:20:52 2010 @@ -0,0 +1,13 @@ + + + +
From the rules
+

theme

+
+
One
+
1
+
Two
+
2
+
+ + Added: z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml Wed Feb 10 00:20:52 2010 @@ -0,0 +1,20 @@ + + + +
From the rules
+
+ + +
+ +
+
+
+
+
+ +
Added: z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html Wed Feb 10 00:20:52 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
Details
+ + Added: z3/xdv/trunk/lib/xdv/tests/modify-theme/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/xpaths.txt Wed Feb 10 00:20:52 2010 @@ -0,0 +1,4 @@ +# This div is added in the rules file +/html/body/div[@id="from-rules"] +/html/body/dl/dt +/html/body/dl/dd From ldr at codespeak.net Wed Feb 10 00:25:26 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 10 Feb 2010 00:25:26 +0100 (CET) Subject: [z3-checkins] r71186 - z3/xdv/trunk/lib/xdv/tests/modify-theme Message-ID: <20100209232526.CA3B1282BDF@codespeak.net> Author: ldr Date: Wed Feb 10 00:25:25 2010 New Revision: 71186 Modified: z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml Log: the css to xpath transform works on other namespaces too Modified: z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml Wed Feb 10 00:25:25 2010 @@ -10,7 +10,7 @@
- +
From ldr at codespeak.net Wed Feb 10 00:55:58 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 10 Feb 2010 00:55:58 +0100 (CET) Subject: [z3-checkins] r71187 - in z3/xdv/trunk/lib/xdv: . tests/modify-theme Message-ID: <20100209235558.A7F8E282BDF@codespeak.net> Author: ldr Date: Wed Feb 10 00:55:56 2010 New Revision: 71187 Modified: z3/xdv/trunk/lib/xdv/compiler.xsl z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html Log: tweaks to synthetic content inclusion Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Wed Feb 10 00:55:56 2010 @@ -501,7 +501,7 @@ ERROR: @content and synthetic - + @@ -531,6 +531,29 @@ + + + + + + + + tag_text + + + + $tag_text + yes + + + + + + + + + Modified: z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/output.html Wed Feb 10 00:55:56 2010 @@ -1,7 +1,19 @@ + + + Theme title + +
From the rules
+ +

+ Check that a stray xmlns does not end up in the output +

theme

One
Modified: z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml (original) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/rules.xml Wed Feb 10 00:55:56 2010 @@ -6,8 +6,19 @@
From the rules
+ +

+ Check that a stray xmlns does not end up in the output +

+ + + +
@@ -16,5 +27,11 @@
- + Modified: z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html (original) +++ z3/xdv/trunk/lib/xdv/tests/modify-theme/theme.html Wed Feb 10 00:55:56 2010 @@ -1,5 +1,8 @@ + + Theme title +

theme

Details
From ldr at codespeak.net Wed Feb 10 19:13:41 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Wed, 10 Feb 2010 19:13:41 +0100 (CET) Subject: [z3-checkins] r71188 - in z3/xdv/trunk/lib/xdv: . tests tests/esi tests/ssi Message-ID: <20100210181341.EF294282BDF@codespeak.net> Author: ldr Date: Wed Feb 10 19:13:36 2010 New Revision: 71188 Added: z3/xdv/trunk/lib/xdv/tests/esi/ z3/xdv/trunk/lib/xdv/tests/esi/content.html z3/xdv/trunk/lib/xdv/tests/esi/output.html z3/xdv/trunk/lib/xdv/tests/esi/rules.xml z3/xdv/trunk/lib/xdv/tests/esi/theme.html z3/xdv/trunk/lib/xdv/tests/esi/xpaths.txt z3/xdv/trunk/lib/xdv/tests/ssi/ z3/xdv/trunk/lib/xdv/tests/ssi/content.html z3/xdv/trunk/lib/xdv/tests/ssi/output.html z3/xdv/trunk/lib/xdv/tests/ssi/rules.xml z3/xdv/trunk/lib/xdv/tests/ssi/theme.html z3/xdv/trunk/lib/xdv/tests/ssi/xpaths.txt Modified: z3/xdv/trunk/lib/xdv/boilerplate.xsl z3/xdv/trunk/lib/xdv/compiler.xsl z3/xdv/trunk/lib/xdv/cssrules.py z3/xdv/trunk/lib/xdv/tests/tests.py Log: Add esi include support, necessatating a general namespace cleanup - the approach now is to remove xhtml namespace on the way in and let the serializer add it back automatically. Modified: z3/xdv/trunk/lib/xdv/boilerplate.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/boilerplate.xsl (original) +++ z3/xdv/trunk/lib/xdv/boilerplate.xsl Wed Feb 10 19:13:36 2010 @@ -2,6 +2,7 @@ @@ -47,27 +48,11 @@ - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Wed Feb 10 19:13:36 2010 @@ -1,10 +1,16 @@ - + + rules.xml boilerplate.xsl @@ -12,8 +18,14 @@ document ;filter_xpath= + + ;filter_xpath= - + + + @@ -53,11 +65,11 @@ - + @@ -98,9 +110,29 @@ - + @@ -117,7 +149,7 @@ - + @@ -134,6 +166,23 @@ + + + + + + + + + + + + + + + @@ -146,9 +195,22 @@ + + + + + + + xmlns + + + + + + @@ -187,15 +249,13 @@ $tag_text yes - + - - - + @@ -470,6 +530,10 @@ + + @@ -494,11 +558,17 @@ + - ERROR: @content and synthetic + ERROR: @content and synthetic not allowed in same rule + + + + + ERROR: @href and synthetic not allowed in same rule @@ -510,23 +580,31 @@ - - - document('', .) - - - + # include virtual="?" wait="yes" + + + ? + - - ERROR: Unknown includemode. - + + + ERROR: Unknown includemode. + + + + document('', .) + @@ -554,6 +632,10 @@ + + Modified: z3/xdv/trunk/lib/xdv/cssrules.py ============================================================================== --- z3/xdv/trunk/lib/xdv/cssrules.py (original) +++ z3/xdv/trunk/lib/xdv/cssrules.py Wed Feb 10 19:13:36 2010 @@ -23,6 +23,8 @@ def convert_css_selectors(rules, prefix='//'): """Convert css rules to xpath rules element tree in place """ + #XXX: There is a :root pseudo-class - http://www.w3.org/TR/css3-selectors/#root-pseudo + # We may wish to add support to lxml.cssselect for it some day. for element in rules.xpath("//@*[namespace-uri()='%s']/.." % utils.namespaces['css']): for name, value in element.attrib.items(): if value: Added: z3/xdv/trunk/lib/xdv/tests/esi/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/esi/content.html Wed Feb 10 19:13:36 2010 @@ -0,0 +1,5 @@ + + + not used + + Added: z3/xdv/trunk/lib/xdv/tests/esi/output.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/esi/output.html Wed Feb 10 19:13:36 2010 @@ -0,0 +1,7 @@ + + + +

theme

+ + + Added: z3/xdv/trunk/lib/xdv/tests/esi/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/esi/rules.xml Wed Feb 10 19:13:36 2010 @@ -0,0 +1,8 @@ + + + + + Added: z3/xdv/trunk/lib/xdv/tests/esi/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/esi/theme.html Wed Feb 10 19:13:36 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme content
+ + Added: z3/xdv/trunk/lib/xdv/tests/esi/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/esi/xpaths.txt Wed Feb 10 19:13:36 2010 @@ -0,0 +1,2 @@ +# The xpath testing mucks about with namespaces... +/html/body/include Added: z3/xdv/trunk/lib/xdv/tests/ssi/content.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/ssi/content.html Wed Feb 10 19:13:36 2010 @@ -0,0 +1,5 @@ + + + not used + + Added: z3/xdv/trunk/lib/xdv/tests/ssi/output.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/ssi/output.html Wed Feb 10 19:13:36 2010 @@ -0,0 +1,7 @@ + + + +

theme

+ + + Added: z3/xdv/trunk/lib/xdv/tests/ssi/rules.xml ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/ssi/rules.xml Wed Feb 10 19:13:36 2010 @@ -0,0 +1,8 @@ + + + + + Added: z3/xdv/trunk/lib/xdv/tests/ssi/theme.html ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/ssi/theme.html Wed Feb 10 19:13:36 2010 @@ -0,0 +1,7 @@ + + + +

theme

+
theme content
+ + Added: z3/xdv/trunk/lib/xdv/tests/ssi/xpaths.txt ============================================================================== --- (empty file) +++ z3/xdv/trunk/lib/xdv/tests/ssi/xpaths.txt Wed Feb 10 19:13:36 2010 @@ -0,0 +1,2 @@ +# SSI includes are rendered as comments +/html/body/comment()[contains(., 'include')] Modified: z3/xdv/trunk/lib/xdv/tests/tests.py ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/tests.py (original) +++ z3/xdv/trunk/lib/xdv/tests/tests.py Wed Feb 10 19:13:36 2010 @@ -21,6 +21,7 @@ class XDVTestCase(unittest.TestCase): writefiles = os.environ.get('XDVTESTS_WRITE_FILES', False) + warnings = os.environ.get('XDVTESTS_WARN', "1").lower() not in ('0', 'false', 'off') testdir = None # override @@ -52,9 +53,10 @@ if old != new: if self.writefiles: open(xslfn + '.old', 'w').write(old) - print "WARNING:", "compiled.xsl has CHANGED" - for line in difflib.unified_diff(old.split('\n'), new.split('\n'), xslfn, 'now'): - print line + if self.warnings: + print "WARNING:", "compiled.xsl has CHANGED" + for line in difflib.unified_diff(old.split('\n'), new.split('\n'), xslfn, 'now'): + print line # Write the compiled xsl out to catch unexpected changes if self.writefiles: @@ -91,8 +93,8 @@ old = open(outputfn).read() new = self.themed_string if old != new: - if self.writefiles: - open(outputfn + '.old', 'w').write(old) + #if self.writefiles: + # open(outputfn + '.old', 'w').write(old) print "ERROR:", "output.html has CHANGED" for line in difflib.unified_diff(old.split('\n'), new.split('\n'), outputfn, 'now'): print line From ldr at codespeak.net Thu Feb 11 10:48:36 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 11 Feb 2010 10:48:36 +0100 (CET) Subject: [z3-checkins] r71192 - in z3/xdv/trunk/lib/xdv/tests: 001 002 003 004 005 006 007 008 009 010 011 012 013 014 Message-ID: <20100211094836.B592E282BD4@codespeak.net> Author: ldr Date: Thu Feb 11 10:48:28 2010 New Revision: 71192 Modified: z3/xdv/trunk/lib/xdv/tests/001/compiled.xsl z3/xdv/trunk/lib/xdv/tests/002/compiled.xsl z3/xdv/trunk/lib/xdv/tests/003/compiled.xsl z3/xdv/trunk/lib/xdv/tests/004/compiled.xsl z3/xdv/trunk/lib/xdv/tests/005/compiled.xsl z3/xdv/trunk/lib/xdv/tests/006/compiled.xsl z3/xdv/trunk/lib/xdv/tests/007/compiled.xsl z3/xdv/trunk/lib/xdv/tests/008/compiled.xsl z3/xdv/trunk/lib/xdv/tests/009/compiled.xsl z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl z3/xdv/trunk/lib/xdv/tests/014/compiled.xsl Log: update compiled.xsl. These may not be very useful really for the tests. I'll consider removing them next time they break. Modified: z3/xdv/trunk/lib/xdv/tests/001/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/001/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/001/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -35,27 +35,11 @@ - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/002/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/002/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/002/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -35,27 +35,11 @@ <xsl:copy-of select="/html/head/title"/> - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/003/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/003/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/003/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -35,27 +35,11 @@ Second Theme Page Title - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/010/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -42,27 +42,11 @@ - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/011/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -39,27 +39,11 @@ - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/012/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -38,27 +38,11 @@ - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/013/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -38,27 +38,11 @@ - + - - - - - - - - - - - - - - - Modified: z3/xdv/trunk/lib/xdv/tests/014/compiled.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/014/compiled.xsl (original) +++ z3/xdv/trunk/lib/xdv/tests/014/compiled.xsl Thu Feb 11 10:48:28 2010 @@ -1,4 +1,4 @@ - + @@ -46,27 +46,11 @@ - + - - - - - - - - - - - - - - - From ldr at codespeak.net Thu Feb 11 12:11:48 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 11 Feb 2010 12:11:48 +0100 (CET) Subject: [z3-checkins] r71196 - z3/xdv/trunk/lib/xdv Message-ID: <20100211111148.F03E8282BD4@codespeak.net> Author: ldr Date: Thu Feb 11 12:11:43 2010 New Revision: 71196 Modified: z3/xdv/trunk/lib/xdv/compiler.xsl Log: fix includemode default Modified: z3/xdv/trunk/lib/xdv/compiler.xsl ============================================================================== --- z3/xdv/trunk/lib/xdv/compiler.xsl (original) +++ z3/xdv/trunk/lib/xdv/compiler.xsl Thu Feb 11 12:11:43 2010 @@ -148,6 +148,9 @@ + + + @@ -580,6 +583,11 @@ + + + document('', .) + + - ? + ? - ERROR: Unknown includemode. + ERROR: Unknown includemode or @method attribute Modified: z3/xdv/trunk/lib/xdv/tests/esi/output.html ============================================================================== --- z3/xdv/trunk/lib/xdv/tests/esi/output.html (original) +++ z3/xdv/trunk/lib/xdv/tests/esi/output.html Thu Feb 11 21:48:01 2010 @@ -2,6 +2,6 @@

theme

- + From ldr at codespeak.net Thu Feb 11 21:51:53 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 11 Feb 2010 21:51:53 +0100 (CET) Subject: [z3-checkins] r71200 - in z3/xdv/trunk: . examples Message-ID: <20100211205153.45126282BEB@codespeak.net> Author: ldr Date: Thu Feb 11 21:51:51 2010 New Revision: 71200 Added: z3/xdv/trunk/examples/varnish.vcl z3/xdv/trunk/varnish.cfg Log: example varnish esi config Added: z3/xdv/trunk/examples/varnish.vcl ============================================================================== --- (empty file) +++ z3/xdv/trunk/examples/varnish.vcl Thu Feb 11 21:51:51 2010 @@ -0,0 +1,14 @@ +backend default { + .host = "127.0.0.1"; + .port = "8000"; +} + +sub vcl_recv { + set req.backend = default; +} + +sub vcl_fetch { + if (obj.http.Content-Type == "text/html; charset=utf-8") { + esi; + } +} Added: z3/xdv/trunk/varnish.cfg ============================================================================== --- (empty file) +++ z3/xdv/trunk/varnish.cfg Thu Feb 11 21:51:51 2010 @@ -0,0 +1,15 @@ +[buildout] +extends = nginx.cfg +parts += + varnish-build + varnish + +[varnish-build] +recipe= zc.recipe.cmmi +url = ${varnish:download-url} + +[varnish] +recipe = plone.recipe.varnish +daemon = ${buildout:parts-directory}/varnish-build/sbin/varnishd +bind = 127.0.0.1:8001 +config = ${buildout:directory}/examples/varnish.vcl From ldr at codespeak.net Thu Feb 11 23:13:49 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 11 Feb 2010 23:13:49 +0100 (CET) Subject: [z3-checkins] r71201 - z3/xdv/trunk/lib/xdv Message-ID: <20100211221349.40131282BD4@codespeak.net> Author: ldr Date: Thu Feb 11 23:13:47 2010 New Revision: 71201 Modified: z3/xdv/trunk/lib/xdv/cssrules.py Log: fix the css rules conversion for if-config='' Modified: z3/xdv/trunk/lib/xdv/cssrules.py ============================================================================== --- z3/xdv/trunk/lib/xdv/cssrules.py (original) +++ z3/xdv/trunk/lib/xdv/cssrules.py Thu Feb 11 23:13:47 2010 @@ -27,11 +27,11 @@ # We may wish to add support to lxml.cssselect for it some day. for element in rules.xpath("//@*[namespace-uri()='%s']/.." % utils.namespaces['css']): for name, value in element.attrib.items(): - if value: - if name.startswith('{%s}' % utils.namespaces['css']): + if name.startswith('{%s}' % utils.namespaces['css']): + if value: element.attrib[utils.localname(name)] = css_to_xpath(value, prefix=prefix) - else: - element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = "" + else: + element.attrib[utils.fullname(element.nsmap[element.prefix], utils.localname(name))] = "" def main(): """Called from console script From ldr at codespeak.net Thu Feb 11 23:14:21 2010 From: ldr at codespeak.net (ldr at codespeak.net) Date: Thu, 11 Feb 2010 23:14:21 +0100 (CET) Subject: [z3-checkins] r71202 - in z3/xdv/trunk: . examples examples/nginx examples/ploneorg templates Message-ID: <20100211221421.6DD6A282BD4@codespeak.net> Author: ldr Date: Thu Feb 11 23:14:18 2010 New Revision: 71202 Added: z3/xdv/trunk/templates/ z3/xdv/trunk/templates/command.sh.in (contents, props changed) z3/xdv/trunk/templates/nginx.conf.in - copied, changed from r71152, z3/xdv/trunk/examples/nginx/nginx.conf.in z3/xdv/trunk/templates/varnish.vcl.in - copied, changed from r71200, z3/xdv/trunk/examples/varnish.vcl Removed: z3/xdv/trunk/examples/nginx/ z3/xdv/trunk/examples/ploneorg/plone.xsl z3/xdv/trunk/examples/varnish.vcl Modified: z3/xdv/trunk/examples/rules.xml z3/xdv/trunk/examples/theme.html z3/xdv/trunk/nginx.cfg z3/xdv/trunk/varnish.cfg Log: A working nginx / varnish setup with esi includes Deleted: /z3/xdv/trunk/examples/ploneorg/plone.xsl ============================================================================== --- /z3/xdv/trunk/examples/ploneorg/plone.xsl Thu Feb 11 23:14:18 2010 +++ (empty file) @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - plone.org[if IE]><style type="text/css" media="all">@import url(/ie.css);</style><![endif][if lte IE 6]><script src="/ie6warn.js" type="text/javascript"></script><![endif] - -
- - - - - -
-
-
-
- - - -
-
-
-
- - Content goes here - -
-
End cell - -
- -
- -
End row -
- -
?
- -
end inner-wrapper -
-
end outer-wrapper - -