Chameleon-2.24/0000755000175000000120000000000012614070273013724 5ustar mborchwheel00000000000000Chameleon-2.24/benchmarks/0000755000175000000120000000000012614070273016041 5ustar mborchwheel00000000000000Chameleon-2.24/benchmarks/bm_chameleon.py0000644000175000001440000000771311743227205021100 0ustar mborchusers00000000000000#!/usr/bin/python2 """ Benchmark for test the performance of Chameleon page template engine. """ __author__ = "mborch@gmail.com (Malthe Borch)" # Python imports import os import sys import optparse import time # Local imports import util def relative(*args): return os.path.join(os.path.dirname(os.path.abspath(__file__)), *args) sys.path.insert(0, relative('..', 'src')) # Chameleon imports from chameleon import PageTemplate LOREM_IPSUM = """Quisque lobortis hendrerit posuere. Curabitur aliquet consequat sapien molestie pretium. Nunc adipiscing luc tus mi, viverra porttitor lorem vulputate et. Ut at purus sem, sed tincidunt ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent pulvinar sodales justo at congue. Praesent aliquet facilisis nisl a molestie. Sed tempus nisl ut augue eleifend tincidunt. Sed a lacinia nulla. Cras tortor est, mollis et consequat at, vulputate et orci. Nulla sollicitudin""" BASE_TEMPLATE = '''
${col}
${alt}
${title.strip()} ''' PAGE_TEMPLATE = ''' images:

${lorem}

''' CONTENT_TEMPLATE = ''' fun1fun2fun3fun4fun5fun6

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam laoreet justo in velit faucibus lobortis. Sed dictum sagittis volutpat. Sed adipiscing vestibulum consequat. Nullam laoreet, ante nec pretium varius, libero arcu porttitor orci, id cursus odio nibh nec leo. Vestibulum dapibus pellentesque purus, sed bibendum tortor laoreet id. Praesent quis sodales ipsum. Fusce ut ligula sed diam pretium sagittis vel at ipsum. Nulla sagittis sem quam, et volutpat velit. Fusce dapibus ligula quis lectus ultricies tempor. Pellente

''' def test_mako(count): template = PageTemplate(CONTENT_TEMPLATE) base = PageTemplate(BASE_TEMPLATE) page = PageTemplate(PAGE_TEMPLATE) table = [xrange(150) for i in xrange(150)] paragraphs = xrange(50) title = 'Hello world!' times = [] for i in range(count): t0 = time.time() data = template.render( table=table, paragraphs=paragraphs, lorem=LOREM_IPSUM, title=title, img_count=50, base=base, page=page, ) t1 = time.time() times.append(t1-t0) return times if __name__ == "__main__": parser = optparse.OptionParser( usage="%prog [options]", description=("Test the performance of Chameleon templates.")) util.add_standard_options_to(parser) (options, args) = parser.parse_args() util.run_benchmark(options, options.num_runs, test_mako) Chameleon-2.24/benchmarks/bm_mako.py0000644000175000001440000000744411641056037020075 0ustar mborchusers00000000000000#!/usr/bin/python """ Benchmark for test the performance of Mako templates engine. Includes: -two template inherences -HTML escaping, XML escaping, URL escaping, whitespace trimming -function defitions and calls -forloops """ __author__ = "virhilo@gmail.com (Lukasz Fidosz)" # Python imports import os import sys import optparse import time # Local imports import util def relative(*args): return os.path.join(os.path.dirname(os.path.abspath(__file__)), *args) sys.path.insert(0, relative('..', 'lib')) # Mako imports from mako.template import Template from mako.lookup import TemplateLookup LOREM_IPSUM = """Quisque lobortis hendrerit posuere. Curabitur aliquet consequat sapien molestie pretium. Nunc adipiscing luc tus mi, viverra porttitor lorem vulputate et. Ut at purus sem, sed tincidunt ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent pulvinar sodales justo at congue. Praesent aliquet facilisis nisl a molestie. Sed tempus nisl ut augue eleifend tincidunt. Sed a lacinia nulla. Cras tortor est, mollis et consequat at, vulputate et orci. Nulla sollicitudin""" BASE_TEMPLATE = """ <%def name="render_table(table)">
% for row in table: % for col in row: % endfor % endfor
${col|h}
<%def name="img(src, alt)"> ${alt} ${title|h,trim} ${next.body()} """ PAGE_TEMPLATE = """ <%inherit file="base.mako"/> % for row in table: % for col in row: % endfor % endfor
${col}
% for nr in xrange(img_count): ${parent.img('/foo/bar/baz.png', 'no image :o')} % endfor ${next.body()} % for nr in paragraphs:

${lorem|x}

% endfor ${parent.render_table(table)} """ CONTENT_TEMPLATE = """ <%inherit file="page.mako"/> <%def name="fun1()"> fun1 <%def name="fun2()"> fun2 <%def name="fun3()"> foo3 <%def name="fun4()"> foo4 <%def name="fun5()"> foo5 <%def name="fun6()"> foo6

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam laoreet justo in velit faucibus lobortis. Sed dictum sagittis volutpat. Sed adipiscing vestibulum consequat. Nullam laoreet, ante nec pretium varius, libero arcu porttitor orci, id cursus odio nibh nec leo. Vestibulum dapibus pellentesque purus, sed bibendum tortor laoreet id. Praesent quis sodales ipsum. Fusce ut ligula sed diam pretium sagittis vel at ipsum. Nulla sagittis sem quam, et volutpat velit. Fusce dapibus ligula quis lectus ultricies tempor. Pellente

${fun1()} ${fun2()} ${fun3()} ${fun4()} ${fun5()} ${fun6()} """ def test_mako(count): lookup = TemplateLookup() lookup.put_string('base.mako', BASE_TEMPLATE) lookup.put_string('page.mako', PAGE_TEMPLATE) template = Template(CONTENT_TEMPLATE, lookup=lookup) table = [xrange(150) for i in xrange(150)] paragraphs = xrange(50) title = 'Hello world!' times = [] for i in range(count): t0 = time.time() data = template.render(table=table, paragraphs=paragraphs, lorem=LOREM_IPSUM, title=title, img_count=50) t1 = time.time() times.append(t1-t0) return times if __name__ == "__main__": parser = optparse.OptionParser( usage="%prog [options]", description=("Test the performance of Mako templates.")) util.add_standard_options_to(parser) (options, args) = parser.parse_args() util.run_benchmark(options, options.num_runs, test_mako) Chameleon-2.24/benchmarks/util.py0000644000175000001440000000340711743215542017441 0ustar mborchusers00000000000000#!/usr/bin/env python """Utility code for benchmark scripts.""" __author__ = "collinwinter@google.com (Collin Winter)" import math import operator def run_benchmark(options, num_runs, bench_func, *args): """Run the given benchmark, print results to stdout. Args: options: optparse.Values instance. num_runs: number of times to run the benchmark bench_func: benchmark function. `num_runs, *args` will be passed to this function. This should return a list of floats (benchmark execution times). """ if options.profile: import cProfile prof = cProfile.Profile() prof.runcall(bench_func, num_runs, *args) prof.print_stats(sort=options.profile_sort) else: data = bench_func(num_runs, *args) if options.take_geo_mean: product = reduce(operator.mul, data, 1) print math.pow(product, 1.0 / len(data)) else: for x in data: print x def add_standard_options_to(parser): """Add a bunch of common command-line flags to an existing OptionParser. This function operates on `parser` in-place. Args: parser: optparse.OptionParser instance. """ parser.add_option("-n", action="store", type="int", default=100, dest="num_runs", help="Number of times to run the test.") parser.add_option("--profile", action="store_true", help="Run the benchmark through cProfile.") parser.add_option("--profile_sort", action="store", type="str", default="time", help="Column to sort cProfile output by.") parser.add_option("--take_geo_mean", action="store_true", help="Return the geo mean, rather than individual data.") Chameleon-2.24/docs/0000755000175000000120000000000012614070273014654 5ustar mborchwheel00000000000000Chameleon-2.24/docs/conf.py0000644000175000001440000001436712035755170016234 0ustar mborchusers00000000000000# -*- coding: utf-8 -*- # # Chameleon documentation build configuration file, created by # sphinx-quickstart on Sun Nov 1 16:08:00 2009. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Chameleon' copyright = u'2008-2011 by Malthe Borch and the Repoze Community' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '2.10' # The full version, including alpha/beta/rc tags. release = '2.10' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = "Chameleon %s documentation" % version # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bchameleonm, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'chameleondoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'chameleon.tex', u'Chameleon Documentation', u'Malthe Borch et. al', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True Chameleon-2.24/docs/configuration.rst0000644000175000001440000000211511622523414020315 0ustar mborchusers00000000000000Configuration ============= Most settings can be provided as keyword-arguments to the template constructor classes. There are certain settings which are required at environment level. Acceptable values are ``"0"``, ``"1"``, or the literals ``"true"`` or ``"false"`` (case-insensitive). General usage ------------- The following settings are useful in general. ``CHAMELEON_EAGER`` Parse and compile templates on instantiation. ``CHAMELEON_CACHE`` When set to a file system path, the template compiler will write its output to files in this directory and use it as a cache. This not only enables you to see the compiler output, but also speeds up startup. ``CHAMELEON_RELOAD`` This setting controls the default value of the ``auto_reload`` parameter. Development ----------- The following settings are mostly useful during development or debugging of the library itself. ``CHAMELEON_DEBUG`` Enables a set of debugging settings which make it easier to discover and research issues with the engine itself. This implicitly enables auto-reload for any template. Chameleon-2.24/docs/index.rst0000644000175000001440000001633212210043501016547 0ustar mborchusers00000000000000Chameleon ========= Chameleon is an HTML/XML template engine for `Python `_. It's designed to generate the document output of a web application, typically HTML markup or XML. The language used is *page templates*, originally a `Zope `_ invention [1]_, but available here as a :ref:`standalone library ` that you can use in any script or application running Python 2.5 and up (including 3.x and `pypy `_). It comes with a set of :ref:`new features `, too. The template engine compiles templates into Python byte-code and is optimized for speed. For a complex template language, the performance is :ref:`very good `. *Found a bug?* Please report issues to the `issue tracker `_. *Need help?* Post to the Pylons `discussion list `_ or join the ``#pyramid`` channel on `Freenode IRC `_. Getting the code ---------------- You can `download `_ the package from the Python package index or install the latest release using setuptools or the newer `distribute `_ (required for Python 3.x):: $ easy_install Chameleon .. _no-dependencies: There are no required library dependencies on Python 2.7 and up [2]_. On 2.5 and 2.6, the `ordereddict `_ and `unittest2 `_ packages are set as dependencies. The project is hosted in a `GitHub repository `_. Code contributions are welcome. The easiest way is to use the `pull request `_ interface. Introduction ------------ The *page templates* language is used within your document structure as special element attributes and text markup. Using a set of simple language constructs, you control the document flow, element repetition, text replacement and translation. .. note:: If you've used page templates in a Zope environment previously, note that Chameleon uses Python as the default expression language (instead of *path* expressions). The basic language (known as the *template attribute language* or TAL) is simple enough to grasp from an example: .. code-block:: genshi

Hello, ${'world'}!

${row.capitalize()} ${col}
The ``${...}`` notation is short-hand for text insertion [3]_. The Python-expression inside the braces is evaluated and the result included in the output. By default, the string is escaped before insertion. To avoid this, use the ``structure:`` prefix: .. code-block:: genshi
${structure: ...}
Note that if the expression result is an object that implements an ``__html__()`` method [4]_, this method will be called and the result treated as "structure". An example of such an object is the ``Markup`` class that's included as a utility:: from chameleon.utils import Markup username = Markup("%s" % username) The macro language (known as the *macro expansion language* or METAL) provides a means of filling in portions of a generic template. On the left, the macro template; on the right, a template that loads and uses the macro, filling in the "content" slot: .. code-block:: genshi

${structure: document.body}

Example — ${document.title}

${document.title}

In the example, the expression type :ref:`load ` is used to retrieve a template from the file system using a path relative to the calling template. The METAL system works with TAL such that you can for instance fill in a slot that appears in a ``tal:repeat`` loop, or refer to variables defined using ``tal:define``. The third language subset is the translation system (known as the *internationalization language* or I18N): .. code-block:: genshi ...
You have ${round(amount, 2)} dollars in your account.
... Each translation message is marked up using ``i18n:translate`` and values can be mapped using ``i18n:name``. Attributes are marked for translation using ``i18n:attributes``. The template engine generates `gettext `_ translation strings from the markup:: "You have ${amount} dollars in your account." If you use a web framework such as `Pyramid `_, the translation system is set up automatically and will negotiate on a *target language* based on the HTTP request or other parameter. If not, then you need to configure this manually. Next steps ---------- This was just an introduction. There are a number of other basic statements that you need to know in order to use the language. This is all covered in the :ref:`language reference `. If you're already familiar with the page template language, you can skip ahead to the :ref:`getting started ` section to learn how to use the template engine in your code. To learn about integration with your favorite web framework see the section on :ref:`framework integration `. License ------- This software is made available under a BSD-like license. Contents ======== .. toctree:: :maxdepth: 2 library.rst reference.rst integration.rst configuration.rst Indices and Tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` Notes ===== .. [1] The template language specifications and API for the Page Templates engine are based on Zope Page Templates (see in particular `zope.pagetemplate `_). However, the Chameleon compiler and Page Templates engine is an entirely new codebase, packaged as a standalone distribution. It does not require a Zope software environment. .. [2] The translation system in Chameleon is pluggable and based on `gettext `_. There is built-in support for the `zope.i18n `_ package. If this package is installed, it will be used by default. The `translationstring `_ package offers some of the same helper and utility classes, without the Zope application interface. .. [3] This syntax was taken from `Genshi `_. .. [4] See the `WebHelpers `_ library which provide a simple wrapper around this method. Chameleon-2.24/docs/integration.rst0000644000175000001440000000266412307560376020013 0ustar mborchusers00000000000000.. _framework-integration: Integration =========== Integration with Chameleon is available for a number of popular web frameworks. The framework will usually provide loading mechanisms and translation (internationalization) configuration. Pyramid ------- Chameleon is the default template engine for the `Pyramid `_ framework. See the section on `Page Templates `_ for a complete reference. Zope 2 / Plone -------------- Install the `five.pt `_ package to replace the reference template engine (globally). Zope Toolkit (ZTK) ------------------ Install the `z3c.pt `_ package for applications based on the `Zope Toolkit `_ (ZTK). Note that you need to explicit use the template classes from this package. Grok ---- Support for the `Grok `_ framework is available in the `grokcore.chameleon `_ package. This package will setup Grok's policy for templating integration and associate the Chameleon template components for the ``.cpt`` template filename extension. Django ------ Install the `django-chameleon-templates `_ app to enable Chameleon as a template engine. Chameleon-2.24/docs/library.rst0000644000175000001440000001267312465077662017143 0ustar mborchusers00000000000000Library Documentation ===================== This section documents the package as a Python library. To learn about the page template language, consult the :ref:`language reference `. .. _getting-started-with-cpt: Getting started --------------- There are several template constructor classes available, one for each of the combinations *text* or *xml*, and *string* or *file*. The file-based constructor requires an absolute path. To set up a templates directory *once*, use the template loader class:: import os path = os.path.dirname(__file__) from chameleon import PageTemplateLoader templates = PageTemplateLoader(os.path.join(path, "templates")) Then, to load a template relative to the provided path, use dictionary syntax:: template = templates['hello.pt'] Alternatively, use the appropriate template class directly. Let's try with a string input:: from chameleon import PageTemplate template = PageTemplate("
Hello, ${name}.
") All template instances are callable. Provide variables by keyword argument:: >>> template(name='John') '
Hello, John.
' .. _fast: Performance ----------- The template engine compiles (or *translates*) template source code into Python byte-code. In simple templates this yields an increase in performance of about 7 times in comparison to the reference implementation. In benchmarks for the content management system `Plone `_, switching to Chameleon yields a request to response improvement of 20-50%. Extension --------- You can extend the language through the expression engine by writing your own expression compiler. Let's try and write an expression compiler for an expression type that will simply uppercase the supplied value. We'll call it ``upper``. You can write such a compiler as a closure: .. code-block:: python import ast def uppercase_expression(string): def compiler(target, engine): uppercased = self.string.uppercase() value = ast.Str(uppercased) return [ast.Assign(targets=[target], value=value)] return compiler To make it available under a certain prefix, we'll add it to the expression types dictionary. .. code-block:: python from chameleon import PageTemplate PageTemplate.expression_types['upper'] = uppercase_expression Alternatively, you could subclass the template class and set the attribute ``expression_types`` to a dictionary that includes your expression: .. code-block:: python from chameleon import PageTemplateFile from chameleon.tales import PythonExpr class MyPageTemplateFile(PageTemplateFile): expression_types = { 'python': PythonExpr, 'upper': uppercase_expression } You can now uppercase strings *natively* in your templates::
It's probably best to stick with a Python expression::
API reference ------------- This section describes the documented API of the library. Templates ~~~~~~~~~ Use the ``PageTemplate*`` template classes to define a template from a string or file input: .. automodule:: chameleon .. autoclass:: chameleon.PageTemplate Note: The remaining classes take the same general configuration arguments. .. automethod:: render .. autoclass:: chameleon.PageTemplateFile(filename, **config) .. autoclass:: chameleon.PageTextTemplate .. autoclass:: chameleon.PageTextTemplateFile Loader ~~~~~~ Some systems have framework support for loading templates from files. The following loader class is directly compatible with the Pylons framework and may be adapted to other frameworks: .. class:: chameleon.PageTemplateLoader(search_path=None, default_extension=None, **config) Load templates from ``search_path`` (must be a string or a list of strings):: templates = PageTemplateLoader(path) example = templates['example.pt'] If ``default_extension`` is provided, this will be added to inputs that do not already have an extension:: templates = PageTemplateLoader(path, ".pt") example = templates['example'] Any additional keyword arguments will be passed to the template constructor:: templates = PageTemplateLoader(path, debug=True, encoding="utf-8") .. automethod:: load Exceptions ~~~~~~~~~~ Chameleon may raise exceptions during both the cooking and the rendering phase, but those raised during the cooking phase (parse and compile) all inherit from a single base class: .. class:: chameleon.TemplateError(msg, token) This exception is the base class of all exceptions raised by the template engine in the case where a template has an error. It may be raised during rendering since templates are processed lazily (unless eager loading is enabled). An error that occurs during the rendering of a template is wrapped in an exception class to disambiguate the two cases: .. class:: chameleon.RenderError(*args) Indicates an exception that resulted from the evaluation of an expression in a template. A complete traceback is attached to the exception beginning with the expression that resulted in the error. The traceback includes a string representation of the template variable scope for further reference. Expressions ~~~~~~~~~~~ For advanced integration, the compiler module provides support for dynamic expression evaluation: .. automodule:: chameleon.compiler .. autoclass:: chameleon.compiler.ExpressionEvaluator Chameleon-2.24/docs/reference.rst0000644000175000000120000014406712614070165017360 0ustar mborchwheel00000000000000:tocdepth: 4 .. _language-reference: .. highlight:: xml Language Reference ================== The language reference is structured such that it can be read as a general introduction to the *page templates* language. It's split into parts that correspond to each of the main language features. Syntax ###### You can safely :ref:`skip this section ` if you're familiar with how template languages work or just want to learn by example. An *attribute language* is a programming language designed to render documents written in XML or HTML markup. The input must be a well-formed document. The output from the template is usually XML-like but isn't required to be well-formed. The statements of the language are document tags with special attributes, and look like this::

...

In the above example, the attribute ``namespace-prefix:command="argument"`` is the statement, and the entire paragraph tag is the statement's element. The statement's element is the portion of the document on which this statement operates. The namespace prefixes are typically declared once, at the top of a template (note that prefix declarations for the template language namespaces are omitted from the template output):: ... Thankfully, sane namespace prefix defaults are in place to let us skip most of the boilerplate::

...

Note how ``tal`` is used without an explicit namespace declaration. Chameleon sets up defaults for ``metal`` and ``i18n`` as well. .. note:: Default prefixes are a special feature of Chameleon. If the ``enable_data_attributes`` option is set then you can use ``data-prefix-command="argument"`` in addition to the namespace prefix attributes. .. _tal: Basics (TAL) ############ The *template attribute language* is used to create dynamic XML-like content. It allows elements of a document to be replaced, repeated, or omitted. Statements ---------- These are the available statements: ================== ============== Statement Description ================== ============== ``tal:define`` Define variables. ``tal:switch`` Defines a switch condition ``tal:condition`` Include element only if expression is true. ``tal:repeat`` Repeat an element. ``tal:case`` Includes element only if expression is equal to parent switch. ``tal:content`` Substitute the content of an element. ``tal:replace`` Replace the element with dynamic content. ``tal:omit-tag`` Omit the element tags, leaving only the inner content. ``tal:attributes`` Dynamically change or insert element attributes. ``tal:on-error`` Substitute the content of an element if processing fails. ================== ============== When there is only one TAL statement per element, the order in which they are executed is simple. Starting with the root element, each element's statements are executed, then each of its child elements is visited, in order, to do the same:: </meta> <body> <div tal:condition="items"> <p>These are your items:</p> <ul> <li tal:repeat="item items" tal:content="item" /> </ul> </div> </body> </html> Any combination of statements may appear on the same element, except that the ``tal:content`` and ``tal:replace`` statements may not be used on the same element. .. note:: The ``tal:case`` and ``tal:switch`` statements are available in Chameleon only. TAL does not use the order in which statements are written in the tag to determine the order in which they are executed. When an element has multiple statements, they are executed in the order printed in the table above. There is a reasoning behind this ordering. Because users often want to set up variables for use in other statements contained within this element or subelements, ``tal:define`` is executed first. Then any switch statement. ``tal:condition`` follows, then ``tal:repeat``, then ``tal:case``. We are now rendering an element; first ``tal:content`` or ``tal:replace``. Finally, before ``tal:attributes``, we have ``tal:omit-tag`` (which is implied with ``tal:replace``). .. note:: *TALES* is used as the expression language for the "stuff in the quotes". The default syntax is simply Python, but other inputs are possible --- see the section on :ref:`expressions <tales>`. ``tal:attributes`` ^^^^^^^^^^^^^^^^^^ Removes, updates or inserts element attributes. :: tal:attributes="href request.url" Syntax ~~~~~~ ``tal:attributes`` syntax:: argument ::= attribute_statement [';' attribute_statement]* attribute_statement ::= (attribute_name expression | expression) attribute_name ::= [namespace-prefix ':'] Name namespace-prefix ::= Name Description ~~~~~~~~~~~ The ``tal:attributes`` statement replaces the value of an attribute (or drops, or creates an attribute) with a dynamic value. The value of each expression is converted to a string, if necessary. .. note:: You can qualify an attribute name with a namespace prefix, for example ``html:table``, if you are generating an XML document with multiple namespaces. If an attribute expression evaluates to ``None``, the attribute is deleted from the statement element (or simply not inserted). If an attribute statement is just an expression, it must evaluate to a Python dict (or implement the methods ``update()`` and ``items()`` from the dictionary specification). If the expression evaluates to the symbol ``default`` (a symbol which is always available when evaluating attributes), its value is defined as the default static attribute value. If there is no such default value, a return value of ``default`` will drop the attribute. If you use ``tal:attributes`` on an element with an active ``tal:replace`` command, the ``tal:attributes`` statement is ignored. If you use ``tal:attributes`` on an element with a ``tal:repeat`` statement, the replacement is made on each repetition of the element, and the replacement expression is evaluated fresh for each repetition. .. note:: If you want to include a semicolon (";") in an expression, it must be escaped by doubling it (";;"). Examples ~~~~~~~~ Replacing a link:: <a href="/sample/link.html" tal:attributes="href context.url()" > ... </a> Replacing two attributes:: <textarea rows="80" cols="20" tal:attributes="rows request.rows();cols request.cols()" /> A checkbox input:: <input type="checkbox" tal:attributes="checked True" /> ``tal:condition`` ^^^^^^^^^^^^^^^^^ Conditionally includes or omits an element:: <div tal:condition="comments"> ... </div> Syntax ~~~~~~ ``tal:condition`` syntax:: argument ::= expression Description ~~~~~~~~~~~ The ``tal:condition`` statement includes the statement element in the template only if the condition is met, and omits it otherwise. If its expression evaluates to a *true* value, then normal processing of the element continues, otherwise the statement element is immediately removed from the template. For these purposes, the value ``nothing`` is false, and ``default`` has the same effect as returning a true value. .. note:: Like Python itself, ZPT considers None, zero, empty strings, empty sequences, empty dictionaries, and instances which return a nonzero value from ``__len__`` or ``__nonzero__`` false; all other values are true, including ``default``. Examples ~~~~~~~~ Test a variable before inserting it:: <p tal:condition="request.message" tal:content="request.message" /> Testing for odd/even in a repeat-loop:: <div tal:repeat="item range(10)"> <p tal:condition="repeat.item.even">Even</p> <p tal:condition="repeat.item.odd">Odd</p> </div> ``tal:content`` ^^^^^^^^^^^^^^^ Replaces the content of an element. Syntax ~~~~~~ ``tal:content`` syntax:: argument ::= (['text'] | 'structure') expression Description ~~~~~~~~~~~ Rather than replacing an entire element, you can insert text or structure in place of its children with the ``tal:content`` statement. The statement argument is exactly like that of ``tal:replace``, and is interpreted in the same fashion. If the expression evaluates to ``nothing``, the statement element is left childless. If the expression evaluates to ``default``, then the element's contents are evaluated. The default replacement behavior is ``text``, which replaces angle-brackets and ampersands with their HTML entity equivalents. The ``structure`` keyword passes the replacement text through unchanged, allowing HTML/XML markup to be inserted. This can break your page if the text contains unanticipated markup (eg. text submitted via a web form), which is the reason that it is not the default. .. note:: The ``structure`` keyword exists to provide backwards compatibility. In Chameleon, the ``structure:`` expression type provides the same functionality (also for inline expressions). Examples ~~~~~~~~ Inserting the user name:: <p tal:content="user.getUserName()">Fred Farkas</p> Inserting HTML/XML:: <p tal:content="structure context.getStory()"> Marked <b>up</b> content goes here. </p> ``tal:define`` ^^^^^^^^^^^^^^ Defines local variables. Syntax ~~~~~~ ``tal:define`` syntax:: argument ::= define_scope [';' define_scope]* define_scope ::= (['local'] | 'global') define_var define_var ::= variable_name expression variable_name ::= Name Description ~~~~~~~~~~~ The ``tal:define`` statement defines variables. When you define a local variable in a statement element, you can use that variable in that element and the elements it contains. If you redefine a variable in a contained element, the new definition hides the outer element's definition within the inner element. Note that valid variable names are any Python identifier string including underscore, although two or more leading underscores are disallowed (used internally by the compiler). Further, names are case-sensitive. Python builtins are always "in scope", but most of them may be redefined (such as ``help``). Exceptions are:: ``float``, ``int``, ``len``, ``long``, ``str``, ``None``, ``True`` and ``False``. In addition, the following names are reserved: ``econtext``, ``rcontext``, ``translate``, ``decode`` and ``convert``. If the expression associated with a variable evaluates to ``nothing``, then that variable has the value ``nothing``, and may be used as such in further expressions. Likewise, if the expression evaluates to ``default``, then the variable has the value ``default``, and may be used as such in further expressions. You can define two different kinds of variables: *local* and *global*. When you define a local variable in a statement element, you can only use that variable in that element and the elements it contains. If you redefine a local variable in a contained element, the new definition hides the outer element's definition within the inner element. When you define a global variables, you can use it in any element processed after the defining element. If you redefine a global variable, you replace its definition for the rest of the template. To set the definition scope of a variable, use the keywords ``local`` or ``global`` in front of the assignment. The default setting is ``local``; thus, in practice, only the ``global`` keyword is used. .. note:: If you want to include a semicolon (";") in an expression, it must be escaped by doubling it (";;"). Examples ~~~~~~~~ Defining a variable:: tal:define="company_name 'Zope Corp, Inc.'" Defining two variables, where the second depends on the first:: tal:define="mytitle context.title; tlen len(mytitle)" ``tal:switch`` and ``tal:case`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Defines a switch clause. :: <ul tal:switch="len(items) % 2"> <li tal:case="True">odd</li> <li tal:case="False">even</li> </ul> Syntax ~~~~~~ ``tal:case`` and ``tal:switch`` syntax:: argument ::= expression Description ~~~~~~~~~~~ The *switch* and *case* construct is a short-hand syntax for matching a set of expressions against a single parent. The ``tal:switch`` statement is used to set a new parent expression and the contained ``tal:case`` statements are then matched in sequence such that only the first match succeeds. Note that the symbol ``default`` affirms the case precisely when no previous case has been successful. It should therefore be placed last. .. note:: These statements are only available in Chameleon 2.x and not part of the ZPT specification. Examples ~~~~~~~~ :: <ul tal:switch="item.type"> <li tal:case="'document'"> Document </li> <li tal:case="'folder'"> Folder </li> <li tal:case="default"> Other </li> </ul> ``tal:omit-tag`` ^^^^^^^^^^^^^^^^ Removes an element, leaving its contents. Syntax ~~~~~~ ``tal:omit-tag`` syntax:: argument ::= [ expression ] Description ~~~~~~~~~~~ The ``tal:omit-tag`` statement leaves the contents of an element in place while omitting the surrounding start and end tags. If the expression evaluates to a *false* value, then normal processing of the element continues and the tags are not omitted. If the expression evaluates to a *true* value, or no expression is provided, the statement element is replaced with its contents. .. note:: Like Python itself, ZPT considers None, zero, empty strings, empty sequences, empty dictionaries, and instances which return a nonzero value from ``__len__`` or ``__nonzero__`` false; all other values are true, including ``default``. Examples ~~~~~~~~ Unconditionally omitting a tag:: <div tal:omit-tag="" comment="This tag will be removed"> <i>...but this text will remain.</i> </div> Conditionally omitting a tag:: <b tal:omit-tag="not:bold">I may be bold.</b> The above example will omit the ``b`` tag if the variable ``bold`` is false. Creating ten paragraph tags, with no enclosing tag:: <span tal:repeat="n range(10)" tal:omit-tag=""> <p tal:content="n">1</p> </span> .. _tal_repeat: ``tal:repeat`` ^^^^^^^^^^^^^^ Repeats an element. Syntax ~~~~~~ ``tal:repeat`` syntax:: argument ::= variable_name expression variable_name ::= Name Description ~~~~~~~~~~~ The ``tal:repeat`` statement replicates a sub-tree of your document once for each item in a sequence. The expression should evaluate to a sequence. If the sequence is empty, then the statement element is deleted, otherwise it is repeated for each value in the sequence. If the expression is ``default``, then the element is left unchanged, and no new variables are defined. The ``variable_name`` is used to define a local variable and a repeat variable. For each repetition, the local variable is set to the current sequence element, and the repeat variable is set to an iteration object. Repeat variables ~~~~~~~~~~~~~~~~~ You use repeat variables to access information about the current repetition (such as the repeat index). The repeat variable has the same name as the local variable, but is only accessible through the built-in variable named ``repeat``. The following information is available from the repeat variable: ================== ============== Attribute Description ================== ============== ``index`` Repetition number, starting from zero. ``number`` Repetition number, starting from one. ``even`` True for even-indexed repetitions (0, 2, 4, ...). ``odd`` True for odd-indexed repetitions (1, 3, 5, ...). ``parity`` For odd-indexed repetitions, this is 'odd', else 'even'. ``start`` True for the starting repetition (index 0). ``end`` True for the ending, or final, repetition. ``first`` True for the first item in a group - see note below ``last`` True for the last item in a group - see note below ``length`` Length of the sequence, which will be the total number of repetitions. ``letter`` Repetition number as a lower-case letter: "a" - "z", "aa" - "az", "ba" - "bz", ..., "za" - "zz", "aaa" - "aaz", and so forth. ``Letter`` Upper-case version of *letter*. ``roman`` Repetition number as a lower-case roman numeral: "i", "ii", "iii", "iv", "v", etc. ``Roman`` Upper-case version of *roman*. ================== ============== You can access the contents of the repeat variable using either dictionary- or attribute-style access, e.g. ``repeat['item'].start`` or ``repeat.item.start``. .. note:: For legacy compatibility, the attributes ``odd``, ``even``, ``number``, ``letter``, ``Letter``, ``roman``, and ``Roman`` are callable (returning ``self``). Note that ``first`` and ``last`` are intended for use with sorted sequences. They try to divide the sequence into group of items with the same value. Examples ~~~~~~~~ Iterating over a sequence of strings:: <p tal:repeat="txt ('one', 'two', 'three')"> <span tal:replace="txt" /> </p> Inserting a sequence of table rows, and using the repeat variable to number the rows:: <table> <tr tal:repeat="item here.cart"> <td tal:content="repeat.item.number">1</td> <td tal:content="item.description">Widget</td> <td tal:content="item.price">$1.50</td> </tr> </table> Nested repeats:: <table border="1"> <tr tal:repeat="row range(10)"> <td tal:repeat="column range(10)"> <span tal:define="x repeat.row.number; y repeat.column.number; z x * y" tal:replace="string:$x * $y = $z">1 * 1 = 1</span> </td> </tr> </table> Insert objects. Separates groups of objects by type by drawing a rule between them:: <div tal:repeat="object objects"> <h2 tal:condition="repeat.object.first.meta_type" tal:content="object.type">Meta Type</h2> <p tal:content="object.id">Object ID</p> <hr tal:condition="object.last.meta_type" /> </div> .. note:: the objects in the above example should already be sorted by type. ``tal:replace`` ^^^^^^^^^^^^^^^ Replaces an element. Syntax ~~~~~~ ``tal:replace`` syntax:: argument ::= ['structure'] expression Description ~~~~~~~~~~~ The ``tal:replace`` statement replaces an element with dynamic content. It replaces the statement element with either text or a structure (unescaped markup). The body of the statement is an expression with an optional type prefix. The value of the expression is converted into an escaped string unless you provide the 'structure' prefix. Escaping consists of converting ``&`` to ``&amp;``, ``<`` to ``&lt;``, and ``>`` to ``&gt;``. .. note:: If the inserted object provides an ``__html__`` method, that method is called with the result inserted as structure. This feature is not implemented by ZPT. If the expression evaluates to ``None``, the element is simply removed. If the value is ``default``, then the element is left unchanged. Examples ~~~~~~~~ Inserting a title:: <span tal:replace="context.title">Title</span> Inserting HTML/XML:: <div tal:replace="structure table" /> .. _tales: Expressions (TALES) ################### The *Template Attribute Language Expression Syntax* (TALES) standard describes expressions that supply :ref:`tal` and :ref:`metal` with data. TALES is *one* possible expression syntax for these languages, but they are not bound to this definition. Similarly, TALES could be used in a context having nothing to do with TAL or METAL. TALES expressions are described below with any delimiter or quote markup from higher language layers removed. Here is the basic definition of TALES syntax:: Expression ::= [type_prefix ':'] String type_prefix ::= Name Here are some simple examples:: 1 + 2 None string:Hello, ${view.user_name} The optional *type prefix* determines the semantics and syntax of the *expression string* that follows it. A given implementation of TALES can define any number of expression types, with whatever syntax you like. It also determines which expression type is indicated by omitting the prefix. Types ----- These are the available TALES expression types: ============= ============== Prefix Description ============= ============== ``exists`` Evaluate the result inside an exception handler; if one of the exceptions ``AttributeError``, ``LookupError``, ``TypeError``, ``NameError``, or ``KeyError`` is raised during evaluation, the result is ``False``, otherwise ``True``. Note that the original result is discarded in any case. ``import`` Import a global symbol using dotted notation. ``load`` Load a template relative to the current template or absolute. ``not`` Negate the expression result ``python`` Evaluate a Python expression ``string`` Format a string ``structure`` Wraps the expression result as *structure*. ============= ============== .. note:: The default expression type is ``python``. .. warning:: The Zope reference engine defaults to a ``path`` expression type, which is closely tied to the Zope framework. This expression is not implemented in Chameleon (but it's available in a Zope framework compatibility package). There's a mechanism to allow fallback to alternative expressions, if one should fail (raise an exception). The pipe character ('|') is used to separate two expressions:: <div tal:define="page request.GET['page'] | 0"> This mechanism applies only to the ``python`` expression type, and by derivation ``string``. .. _tales_built_in_names: ``python`` ^^^^^^^^^^ Evaluates a Python expression. Syntax ~~~~~~ Python expression syntax:: Any valid Python language expression Description ~~~~~~~~~~~ Python expressions are executed natively within the translated template source code. There is no built-in security apparatus. ``string`` ^^^^^^^^^^ Syntax ~~~~~~ String expression syntax:: string_expression ::= ( plain_string | [ varsub ] )* varsub ::= ( '$' Variable ) | ( '${ Expression }' ) plain_string ::= ( '$$' | non_dollar )* non_dollar ::= any character except '$' Description ~~~~~~~~~~~ String expressions interpret the expression string as text. If no expression string is supplied the resulting string is *empty*. The string can contain variable substitutions of the form ``$name`` or ``${expression}``, where ``name`` is a variable name, and ``expression`` is a TALES-expression. The escaped string value of the expression is inserted into the string. .. note:: To prevent a ``$`` from being interpreted this way, it must be escaped as ``$$``. Examples ~~~~~~~~ Basic string formatting:: <span tal:replace="string:$this and $that"> Spam and Eggs </span> <p tal:content="string:${request.form['total']}"> total: 12 </p> Including a dollar sign:: <p tal:content="string:$$$cost"> cost: $42.00 </p> .. _import-expression: ``import`` ^^^^^^^^^^ Imports a module global. .. _structure-expression: ``structure`` ^^^^^^^^^^^^^ Wraps the expression result as *structure*: The replacement text is inserted into the document without escaping, allowing HTML/XML markup to be inserted. This can break your page if the text contains unanticipated markup (eg. text submitted via a web form), which is the reason that it is not the default. .. _load-expression: ``load`` ^^^^^^^^ Loads a template instance. Syntax ~~~~~~ Load expression syntax:: Relative or absolute file path Description ~~~~~~~~~~~ The template will be loaded using the same template class as the calling template. Examples ~~~~~~~~ Loading a template and using it as a macro:: <div tal:define="master load: ../master.pt" metal:use-macro="master" /> Built-in names -------------- These are the names always available in the TALES expression namespace: - ``default`` - special value used to specify that existing text or attributes should not be replaced. See the documentation for individual TAL statements for details on how they interpret *default*. - ``repeat`` - the *repeat* variables; see :ref:`tal_repeat` for more information. - ``template`` - reference to the template which was first called; this symbol is carried over when using macros. - ``macros`` - reference to the macros dictionary that corresponds to the current template. .. _metal: Macros (METAL) ############## The *Macro Expansion Template Attribute Language* (METAL) standard is a facility for HTML/XML macro preprocessing. It can be used in conjunction with or independently of TAL and TALES. Macros provide a way to define a chunk of presentation in one template, and share it in others, so that changes to the macro are immediately reflected in all of the places that share it. Additionally, macros are always fully expanded, even in a template's source text, so that the template appears very similar to its final rendering. A single Page Template can accomodate multiple macros. Namespace --------- The METAL namespace URI and recommended alias are currently defined as:: xmlns:metal="http://xml.zope.org/namespaces/metal" Just like the TAL namespace URI, this URI is not attached to a web page; it's just a unique identifier. This identifier must be used in all templates which use METAL. Statements ---------- METAL defines a number of statements: * ``metal:define-macro`` Define a macro. * ``metal:use-macro`` Use a macro. * ``metal:extend-macro`` Extend a macro. * ``metal:define-slot`` Define a macro customization point. * ``metal:fill-slot`` Customize a macro. Although METAL does not define the syntax of expression non-terminals, leaving that up to the implementation, a canonical expression syntax for use in METAL arguments is described in TALES Specification. ``define-macro`` ^^^^^^^^^^^^^^^^ Defines a macro. Syntax ~~~~~~ ``metal:define-macro`` syntax:: argument ::= Name Description ~~~~~~~~~~~ The ``metal:define-macro`` statement defines a macro. The macro is named by the statement expression, and is defined as the element and its sub-tree. Examples ~~~~~~~~ Simple macro definition:: <p metal:define-macro="copyright"> Copyright 2011, <em>Foobar</em> Inc. </p> ``define-slot`` ^^^^^^^^^^^^^^^ Defines a macro customization point. Syntax ~~~~~~ ``metal:define-slot`` syntax:: argument ::= Name Description ~~~~~~~~~~~ The ``metal:define-slot`` statement defines a macro customization point or *slot*. When a macro is used, its slots can be replaced, in order to customize the macro. Slot definitions provide default content for the slot. You will get the default slot contents if you decide not to customize the macro when using it. The ``metal:define-slot`` statement must be used inside a ``metal:define-macro`` statement. Slot names must be unique within a macro. Examples ~~~~~~~~ Simple macro with slot:: <p metal:define-macro="hello"> Hello <b metal:define-slot="name">World</b> </p> This example defines a macro with one slot named ``name``. When you use this macro you can customize the ``b`` element by filling the ``name`` slot. ``fill-slot`` ^^^^^^^^^^^^^ Customize a macro. Syntax ~~~~~~ ``metal:fill-slot`` syntax:: argument ::= Name Description ~~~~~~~~~~~ The ``metal:fill-slot`` statement customizes a macro by replacing a *slot* in the macro with the statement element (and its content). The ``metal:fill-slot`` statement must be used inside a ``metal:use-macro`` statement. Slot names must be unique within a macro. If the named slot does not exist within the macro, the slot contents will be silently dropped. Examples ~~~~~~~~ Given this macro:: <p metal:define-macro="hello"> Hello <b metal:define-slot="name">World</b> </p> You can fill the ``name`` slot like so:: <p metal:use-macro="container['master.html'].macros.hello"> Hello <b metal:fill-slot="name">Kevin Bacon</b> </p> ``use-macro`` ^^^^^^^^^^^^^ Use a macro. Syntax ~~~~~~ ``metal:use-macro`` syntax:: argument ::= expression Description ~~~~~~~~~~~ The ``metal:use-macro`` statement replaces the statement element with a macro. The statement expression describes a macro definition. .. note:: In Chameleon the expression may point to a template instance; in this case it will be rendered in its entirety. ``extend-macro`` ^^^^^^^^^^^^^^^^ Extends a macro. Syntax ~~~~~~ ``metal:extend-macro`` syntax:: argument ::= expression Description ~~~~~~~~~~~ To extend an existing macro, choose a name for the macro and add a define-macro attribute to a document element with the name as the argument. Add an extend-macro attribute to the document element with an expression referencing the base macro as the argument. The extend-macro must be used in conjunction with define-macro, and must not be used with use-macro. The element's subtree is the macro body. Examples ~~~~~~~~ :: <div metal:define-macro="page-header" metal:extend-macro="standard_macros['page-header']"> <div metal:fill-slot="breadcrumbs"> You are here: <div metal:define-slot="breadcrumbs"/> </div> </div> .. _i18n: Translation (I18N) ################## Translation of template contents and attributes is supported via the ``i18n`` namespace and message objects. Messages -------- The translation machinery defines a message as *any object* which is not a string or a number and which does not provide an ``__html__`` method. When any such object is inserted into the template, the translate function is invoked first to see if it needs translation. The result is always coerced to a native string before it's inserted into the template. Translation function -------------------- The simplest way to hook into the translation machinery is to provide a translation function to the template constructor or at render-time. In either case it should be passed as the keyword argument ``translate``. The function has the following signature: .. code-block:: python def translate(msgid, domain=None, mapping=None, context=None, target_language=None, default=None): ... The result should be a string or ``None``. If another type of object is returned, it's automatically coerced into a string. If `zope.i18n <http://pypi.python.org/pypi/zope.i18n>`_ is available, the translation machinery defaults to using its translation function. Note that this function requires messages to conform to the message class from `zope.i18nmessageid <http://pypi.python.org/pypi/zope.i18nmessageid>`_; specifically, messages must have attributes ``domain``, ``mapping`` and ``default``. Example use: .. code-block:: python from zope.i18nmessageid import MessageFactory _ = MessageFactory("food") apple = _(u"Apple") There's currently no further support for other translation frameworks. Using Zope's translation framework ----------------------------------- The translation function from ``zope.i18n`` relies on *translation domains* to provide translations. These are components that are registered for some translation domain identifier and which implement a ``translate`` method that translates messages for that domain. .. note:: To register translation domain components, the Zope Component Architecture must be used (see `zope.component <http://pypi.python.org/pypi/zope.component>`_). The easiest way to configure translation domains is to use the the ``registerTranslations`` ZCML-directive; this requires the use of the `zope.configuration <http://pypi.python.org/pypi/zope.configuration>`_ package. This will set up translation domains and gettext catalogs automatically: .. code-block:: xml <configure xmlns="http://namespaces.zope.org/zope" xmlns:i18n="http://xml.zope.org/namespaces/i18n"> <i18n:registerTranslations directory="locales" /> </configure> The ``./locales`` directory must follow a particular directory structure: .. code-block:: bash ./locales/en/LC_MESSAGES ./locales/de/LC_MESSAGES ... In each of the ``LC_MESSAGES`` directories, one `GNU gettext <http://en.wikipedia.org/wiki/GNU_gettext>`_ file in the ``.po`` format must be present per translation domain: .. code-block:: po # ./locales/de/LC_MESSAGES/food.po msgid "" msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "Apple" msgstr "Apfel" It may be necessary to compile the message catalog using the ``msgfmt`` utility. This will produce a ``.mo`` file. Translation domains without gettext ----------------------------------- The following example demonstrates how to manually set up and configure a translation domain for which messages are provided directly:: from zope import component from zope.i18n.simpletranslationdomain import SimpleTranslationDomain food = SimpleTranslationDomain("food", { ('de', u'Apple'): u'Apfel', }) component.provideUtility(food, food.domain) An example of a custom translation domain class:: from zope import interface class TranslationDomain(object): interface.implements(ITranslationDomain) def translate(self, msgid, mapping=None, context=None, target_language=None, default=None): ... component.provideUtility(TranslationDomain(), name="custom") This approach can be used to integrate other translation catalog implementations. .. highlight:: xml Namespace --------- The ``i18n`` namespace URI and recommended prefix are currently defined as:: xmlns:i18n="http://xml.zope.org/namespaces/i18n" This is not a URL, but merely a unique identifier. Do not expect a browser to resolve it successfully. Statements ---------- The allowable ``i18n`` statements are: - ``i18n:translate`` - ``i18n:domain`` - ``i18n:context`` - ``i18n:source`` - ``i18n:target`` - ``i18n:name`` - ``i18n:attributes`` - ``i18n:data`` - ``i18n:comment`` - ``i18n:ignore`` - ``i18n:ignore-attributes`` ``i18n:translate`` ^^^^^^^^^^^^^^^^^^ This attribute is used to mark units of text for translation. If this attribute is specified with an empty string as the value, the message ID is computed from the content of the element bearing this attribute. Otherwise, the value of the element gives the message ID. ``i18n:domain`` ^^^^^^^^^^^^^^^ The ``i18n:domain`` attribute is used to specify the domain to be used to get the translation. If not specified, the translation services will use a default domain. The value of the attribute is used directly; it is not a TALES expression. ``i18n:context`` ^^^^^^^^^^^^^^^ The ``i18n:context`` attribute is used to specify the context to be used to get the translation. If not specified, the translation services will use a default context. The context is generally use to distinguish identical texts in different context (because in a translation this may not be the case.) The value of the attribute is used literally; it is not an expression. ``i18n:source`` ^^^^^^^^^^^^^^^ The ``i18n:source`` attribute specifies the language of the text to be translated. The default is ``nothing``, which means we don't provide this information to the translation services. ``i18n:target`` ^^^^^^^^^^^^^^^ .. warning:: This is currrently ignored. The ``i18n:target`` attribute specifies the language of the translation we want to get. If the value is ``default``, the language negotiation services will be used to choose the destination language. If the value is ``nothing``, no translation will be performed; this can be used to suppress translation within a larger translated unit. Any other value must be a language code. The attribute value is a TALES expression; the result of evaluating the expression is the language code or one of the reserved values. .. note:: ``i18n:target`` is primarily used for hints to text extraction tools and translation teams. If you had some text that should only be translated to e.g. German, then it probably shouldn't be wrapped in an ``i18n:translate`` span. ``i18n:name`` ^^^^^^^^^^^^^ Name the content of the current element for use in interpolation within translated content. This allows a replaceable component in content to be re-ordered by translation. For example:: <span i18n:translate=''> <span tal:replace='context.name' i18n:name='name' /> was born in <span tal:replace='context.country_of_birth' i18n:name='country' />. </span> would cause this text to be passed to the translation service:: "${name} was born in ${country}." ``i18n:attributes`` ^^^^^^^^^^^^^^^^^^^ This attribute will allow us to translate attributes of HTML tags, such as the ``alt`` attribute in the ``img`` tag. The ``i18n:attributes`` attribute specifies a list of attributes to be translated with optional message IDs for each; if multiple attribute names are given, they must be separated by semicolons. Message IDs used in this context must not include whitespace. Note that the value of the particular attributes come either from the HTML attribute value itself or from the data inserted by ``tal:attributes``. If an attibute is to be both computed using ``tal:attributes`` and translated, the translation service is passed the result of the TALES expression for that attribute. An example:: <img src="http://foo.com/logo" alt="Visit us" tal:attributes="alt context.greeting" i18n:attributes="alt" > In this example, we let ``tal:attributes`` set the value of the ``alt`` attribute to the text "Stop by for a visit!". This text will be passed to the translation service, which uses the result of language negotiation to translate "Stop by for a visit!" into the requested language. The example text in the template, "Visit us", will simply be discarded. Another example, with explicit message IDs:: <img src="../icons/uparrow.png" alt="Up" i18n:attributes="src up-arrow-icon; alt up-arrow-alttext" > Here, the message ID ``up-arrow-icon`` will be used to generate the link to an icon image file, and the message ID 'up-arrow-alttext' will be used for the "alt" text. ``i18n:data`` ^^^^^^^^^^^^^ Since TAL always returns strings, we need a way in ZPT to translate objects, one of the most obvious cases being ``datetime`` objects. The ``data`` attribute will allow us to specify such an object, and ``i18n:translate`` will provide us with a legal format string for that object. If ``data`` is used, ``i18n:translate`` must be used to give an explicit message ID, rather than relying on a message ID computed from the content. ``i18n:comment`` ^^^^^^^^^^^^^^^^ The ``i18n:comment`` attribute can be used to add extra comments for translators. It is not used by Chameleon for processing, but will be picked up by tools like `lingua <http://pypi.python.org/pypi/lingua>`_. An example: <h3 i18n:comment="Header for the news section" i18n:translate="">News</h3> ``i18n:ignore`` ^^^^^^^^^^^^^^^ The ``i18n:ignore`` attribute can be used to inform translation extraction tools like `i18ndude <http://pypi.python.org/pypi/i18ndude>`_ to not give a warning/error on the given tag if there is no ``i18n:translate`` attribute. An example: <h1 i18n:ignore="">News</h3> ``i18n:ignore-attributes`` ^^^^^^^^^^^^^^^^^^^^^^^^^^ The ``i18n:ignore-attributes``, just like ``i18n:ignore`` is expected to be used by translation extraction tools like `i18ndude <http://pypi.python.org/pypi/i18ndude>`_. If ``i18n:ignore`` makes text within a tag to be ignored, ``i18n:ignore-attributes`` marks the given attributes as ignored. An example: <a href="http://python.org" title="Python!" i18n:ignore-attributes="title">Python website</a> Relation with TAL processing ---------------------------- The attributes defined in the ``i18n`` namespace modify the behavior of the TAL interpreter for the ``tal:attributes``, ``tal:content``, ``tal:repeat``, and ``tal:replace`` attributes, but otherwise do not affect TAL processing. Since these attributes only affect TAL processing by causing translations to occur at specific times, using these with a TAL processor which does not support the ``i18n`` namespace degrades well; the structural expectations for a template which uses the ``i18n`` support is no different from those for a page which does not. The only difference is that translations will not be performed in a legacy processor. Relation with METAL processing ------------------------------- When using translation with METAL macros, the internationalization context is considered part of the specific documents that page components are retrieved from rather than part of the combined page. This makes the internationalization context lexical rather than dynamic, making it easier for a site builder to understand the behavior of each element with respect to internationalization. Let's look at an example to see what this means:: <html i18n:translate='' i18n:domain='EventsCalendar' metal:use-macro="container['master.html'].macros.thismonth"> <div metal:fill-slot='additional-notes'> <ol tal:condition="context.notes"> <li tal:repeat="note context.notes"> <tal:block tal:omit-tag="" tal:condition="note.heading"> <strong tal:content="note.heading"> Note heading goes here </strong> <br /> </tal:block> <span tal:replace="note/description"> Some longer explanation for the note goes here. </span> </li> </ol> </div> </html> And the macro source:: <html i18n:domain='CalendarService'> <div tal:replace='python:DateTime().Month()' i18n:translate=''>January</div> <!-- really hairy TAL code here ;-) --> <div define-slot="additional-notes"> Place for the application to add additional notes if desired. </div> </html> Note that the macro is using a different domain than the application (which it should be). With lexical scoping, no special markup needs to be applied to cause the slot-filler in the application to be part of the same domain as the rest of the application's page components. If dynamic scoping were used, the internationalization context would need to be re-established in the slot-filler. Extracting translatable message ------------------------------- Translators use `PO files <http://www.gnu.org/software/hello/manual/gettext/PO-Files.html>`_ when translating messages. To create and update PO files you need to do two things: *extract* all messages from python and templates files and store them in a ``.pot`` file, and for each language *update* its ``.po`` file. Chameleon facilitates this by providing extractors for `Babel <http://babel.edgewall.org/>`_. To use this you need modify ``setup.py``. For example: .. code-block:: python from setuptools import setup setup(name="mypackage", install_requires = [ "Babel", ], message_extractors = { "src": [ ("**.py", "chameleon_python", None ), ("**.pt", "chameleon_xml", None ), ]}, ) This tells Babel to scan the ``src`` directory while using the ``chameleon_python`` extractor for all ``.py`` files and the ``chameleon_xml`` extractor for all ``.pt`` files. You can now use Babel to manage your PO files: .. code-block:: bash python setup.py extract_messages --output-file=i18n/mydomain.pot python setup.py update_catalog \ -l nl \ -i i18n/mydomain.pot \ -o i18n/nl/LC_MESSAGES/mydomain.po python setup.py compile_catalog \ --directory i18n --locale nl You can also configure default options in a ``setup.cfg`` file. For example:: [compile_catalog] domain = mydomain directory = i18n [extract_messages] copyright_holder = Acme Inc. output_file = i18n/mydomain.pot charset = UTF-8 [init_catalog] domain = mydomain input_file = i18n/mydomain.pot output_dir = i18n [update_catalog] domain = mydomain input_file = i18n/mydomain.pot output_dir = i18n previous = true You can now use the Babel commands directly:: python setup.py extract_messages python setup.py update_catalog python setup.py compile_catalog ${...} operator ############### The ``${...}`` notation is short-hand for text insertion. The Python-expression inside the braces is evaluated and the result included in the output (all inserted text is escaped by default): .. code-block:: html <div id="section-${index + 1}"> ${content} </div> To escape this behavior, prefix the notation with a backslash character: ``\${...}``. Note that if an object implements the ``__html__`` method, the result of this method will be inserted as-is (without XML escaping). Code blocks ########### The ``<?python ... ?>`` notation allows you to embed Python code in templates: .. code-block:: html <div> <?python numbers = map(str, range(1, 10)) ?> Please input a number from the range ${", ".join(numbers)}. </div> The scope of name assignments is up to the nearest macro definition, or the template, if macros are not used. Note that code blocks can span multiple line and start on the next line of where the processing instruction begins: .. code-block:: html <?python foo = [1, 2, 3] ?> You can use this to debug templates: .. code-block:: html <div> <?python import pdb; pdb.set_trace() ?> </div> Markup comments ############### You can apply the "!" and "?" modifiers to change how comments are processed: Drop ``<!--! This comment will be dropped from output -->`` Verbatim ``<!--? This comment will be included verbatim -->`` That is, evaluation of ``${...}`` expressions is disabled if the comment opens with the "?" character. .. _new-features: Language extensions ################### Chameleon extends the *page template* language with a new expression types and language features. Some take inspiration from `Genshi <http://genshi.edgewall.org/>`_. *New expression types* The :ref:`structure <structure-expression>` expression wraps an expression result as *structure*:: <div>${structure: body.text}</div> The :ref:`import <import-expression>` expression imports module globals:: <div tal:define="compile import: re.compile"> ... </div> The :ref:`load <load-expression>` expression loads templates relative to the current template:: <div tal:define="compile load: main.pt"> ... </div> *Tuple unpacking* The ``tal:define`` and ``tal:repeat`` statements support tuple unpacking:: tal:define="(a, b, c) [1, 2, 3]" Extended `iterable unpacking <http://www.python.org/dev/peps/pep-3132/>`_ using the asterisk character is not currently supported (even for versions of Python that support it natively). *Dictionary lookup as fallback after attribute error* If attribute lookup (using the ``obj.<name>`` syntax) raises an ``AttributeError`` exception, a secondary lookup is attempted using dictionary lookup --- ``obj['<name>']``. Behind the scenes, this is done by rewriting all attribute-lookups to a custom lookup call: .. code-block:: python def lookup_attr(obj, key): try: return getattr(obj, key) except AttributeError as exc: try: get = obj.__getitem__ except AttributeError: raise exc try: return get(key) except KeyError: raise exc *Inline string substitution* In element attributes and in the text or tail of an element, string expression interpolation is available using the ``${...}`` syntax:: <span class="content-${item_type}"> ${title or item_id} </span> *Code blocks* Using ``<?python ... ?>`` notation, you can embed Python statements in your templates: .. code-block:: html <div> <?python numbers = map(str, range(1, 10)) ?> Please input a number from the range ${", ".join(numbers)}. </div> *Literal content* While the ``tal:content`` and ``tal:repeat`` attributes both support the ``structure`` keyword which inserts the content as a literal (without XML-escape), an object may also provide an ``__html__`` method to the same effect. The result of the method will be inserted as *structure*. This is particularly useful for content which is substituted using the expression operator: ``"${...}"`` since the ``structure`` keyword is not allowed here. *Switch statement* Two new attributes have been added: ``tal:switch`` and ``tal:case``. A case attribute works like a condition and only allows content if the value matches that of the nearest parent switch value. Incompatibilities and differences ################################# There are a number of incompatibilities and differences between the Chameleon language implementation and the Zope reference implementation (ZPT): *Default expression* The default expression type is Python. *Template arguments* Arguments passed by keyword to the render- or call method are inserted directly into the template execution namespace. This is different from ZPT where these are only available through the ``options`` dictionary. Zope:: <div tal:content="options/title" /> Chameleon:: <div tal:content="title" /> *Special symbols* The ``CONTEXTS`` symbol is not available. The `z3c.pt <http://pypi.python.org/pypi/z3c.pt>`_ package works as a compatibility layer. The template classes in this package provide a implementation which is fully compatible with ZPT. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/docs/requirements.txt����������������������������������������������������������������0000644�0001750�0000144�00000000020�12111137043�020162� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon==2.11 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/���������������������������������������������������������������������������������0000755�0001750�0000012�00000000000�12614070273�014513� 5����������������������������������������������������������������������������������������������������ustar �mborch��������������������������wheel���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/Chameleon.egg-info/��������������������������������������������������������������0000755�0001750�0000012�00000000000�12614070273�020100� 5����������������������������������������������������������������������������������������������������ustar �mborch��������������������������wheel���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/Chameleon.egg-info/PKG-INFO������������������������������������������������������0000644�0001750�0000144�00000137567�12614070272�021262� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Metadata-Version: 1.1 Name: Chameleon Version: 2.24 Summary: Fast HTML/XML Template Compiler. Home-page: http://www.pagetemplates.org/ Author: Malthe Borch Author-email: mborch@gmail.com License: BSD-like (http://repoze.org/license.html) Description: Overview ======== Chameleon is an HTML/XML template engine for `Python <http://www.python.org>`_. It uses the *page templates* language. You can use it in any Python web application with just about any version of Python (2.5 and up, including 3.x and `pypy <http://pypy.org>`_). Visit the `website <http://pagetemplates.org/>`_ for more information or the `documentation <http://chameleon.readthedocs.org/en/latest/>`_. License and Copyright --------------------- This software is made available as-is under a BSD-like license [1]_ (see included copyright notice). Notes ----- .. [1] This software is licensed under the `Repoze <http://repoze.org/license.html>`_ license. Changes ======= 2.24 (2015-10-28) ----------------- - Fixed Python 3.5 compatibility. - Fixed brown bag release. 2.23 (2015-10-26) ----------------- - Added ``enable_data_attributes`` option that allows using HTML5 data attributes as control attributes instead or in addition to XML namespace attributes. 2.22 (2015-02-06) ----------------- - Fix brown bag release. 2.21 (2015-02-06) ----------------- - Added ``RenderError`` exception which indicates that an error occurred during the evaluation of an expression. - Clean up ``TemplateError`` exception implementation. 2.20 (2015-01-12) ----------------- - Pass ``search_path`` to template class when loaded using ``TemplateLoader`` (or one of the derived classes). [faassen] 2.19 (2015-01-06) ----------------- - Fix logging deprecation. - Fix environment-based configuration logging error. 2.18 (2014-11-03) ----------------- - Fix minor compilation error. 2.17 (2014-11-03) ----------------- - Add support for ``i18n:context``. [wiggy] - Add missing 'parity' repeat property. [voxspox] - Don't modify environment when getting variables from it. [fschulze] 2.16 (2014-05-06) ----------------- - If a repeat expression evaluates to ``None`` then it is now equivalent to an empty set. This changes a behavior introduced in 2.14. This fixes issue #172. - Remove fossil test dependency on deprecated ``distribute``. - Add explicit support / testing for Python 3.3 / 3.4. - Drop explicit support for Python 2.5 (out of maintenance, and no longer supported by ``tox`` or ``Travis-CI``). 2.15 (2014-03-11) ----------------- - Add Support for Python 3.4's ``NameConstant``. [brakhane] 2.14 (2013-11-28) ----------------- - Element repetition using the ``TAL`` namespace no longer includes whitespace. This fixes issue #110. - Use absolute import for ``chameleon.interfaces`` module. This fixes issue #161. 2.13-1 (2013-10-24) ------------------- - Fixing brown bag release. 2.13 (2013-10-21) ----------------- Bugfixes: - The template cache mechanism now includes additional configuration settings as part of the cache key such as ``strict`` and ``trim_attribute_space``. [ossmkitty] - Fix cache issue where sometimes cached templates would not load correctly. [ossmkitty] - In debug-mode, correctly remove temporary files when the module loader is garbage-collected (on ``__del__``). [graffic] - Fix error message when duplicate i18n:name directives are used in a translation. - Using the three-argument form of ``getattr`` on a ``chameleon.tal.RepeatDict`` no longer raises ``KeyError``, letting the default provided to ``getattr`` be used. This fixes attempting to adapt a ``RepeatDict`` to a Zope interface under PyPy. 2.12 (2013-03-26) ----------------- Changes: - When a ``tal:case`` condition succeeds, no other case now will. Bugfixes: - Implicit translation now correctly extracts and normalizes complete sentences, instead of words. [witsch] - The ``default`` symbol in a ``tal:case`` condition now allows the element only if no other case succeeds. 2.11 (2012-11-15) ----------------- Bugfixes: - An issue was resolved where a METAL statement was combined with a ``tal:on-error`` handler. - Fix minor parser issue with incorrectly formatted processing instructions. - Provide proper error handling for Python inline code blocks. Features: - The simple translation function now supports the ``translationstring`` interface. Optimizations: - Minor optimization which correctly detects when an element has no attributes. 2.10 (2012-10-12) ----------------- Deprecations: - The ``fast_translate`` function has been deprecated. Instead, the default translation function is now always a function that simply interpolates the mapping onto the message default or id. The motivation is that since version 2.9, the ``context`` argument is non-trivial: the ``econtext`` mapping is passed. This breaks an expectation on the Zope platform that the ``context`` parameter is the HTTP request. Previously, with Chameleon this parameter was simply not provided and so that did not cause issues as such. - The ``ast24`` module has been renamed to ``ast25``. This should help clear up any confusion that Chameleon 2.x might be support a Python interpreter less than version 2.5 (it does not). Features: - The ``ProxyExpr`` expression class (and hence the ``load:`` expression type) is now a TALES-expression. In practical terms, this means that the expression type (which computes a string result using the standard ``"${...}"`` interpolation syntax and proxies the result through a function) now supports fallback using the pipe operator (``"|"``). This fixes issue #128. - An attempt to interpolate using the empty string as the expression (i.e. ``${}``) now does nothing: the string ``${}`` is simply output as is. - Added support for adding, modifying, and removing attributes using a dictionary expression in ``tal:attributes`` (analogous to Genshi's ``py:attrs`` directive):: <div tal:attributes="name value; attrs" /> In the example above, ``name`` is an identifier, while ``value`` and ``attrs`` are Python expressions. However, ``attrs`` must evaluate to a Python dictionary object (more concisely, the value must implement the dictionary API-methods ``update()`` and ``items()``). Optimizations: - In order to cut down on the size of the compiled function objects, some conversion and quoting statements have been put into functions. In one measurement, the reduction was 35%. The benchmark suite does *not* report of an increased render time (actually slightly decreased). Bugfixes: - An exception is now raised if a trivial string is passed for ``metal:fill-slot``. This fixes issue #89. - An empty string is now never translated. Not really a bug, but it's been reported in as an issue (#92) because some translation frameworks handle this case incorrectly. - The template module loader (file cache) now correctly encodes generated template source code as UTF-8. This fixes issue #125. - Fixed issue where a closure might be reused unsafely in nested template rendering. - Fixed markup class ``__repr__`` method. This fixes issue #124. - Added missing return statement to fix printing the non-abbreviated filename in case of an exception. [tomo] 2.9.2 (2012-06-06) ------------------ Bugfixes: - Fixed a PyPy incompatibility. - Fixed issue #109 which caused testing failures on some platforms. 2.9.1 (2012-06-01) ------------------ Bugfixes: - Fixed issue #103. The ``tal:on-error`` statement now always adds an explicit end-tag to the element, even with a substitution content of nothing. - Fixed issue #113. The ``tal:on-error`` statement now works correctly also for dynamic attributes. That is, the fallback tag now includes only static attributes. - Fixed name error which prevented the benchmark from running correctly. Compatibility: - Fixed deprecation warning on Python 3 for zope interface implements declaration. This fixes issue #116. 2.9.0 (2012-05-31) ------------------ Features: - The translation function now gets the ``econtext`` argument as the value for ``context``. Note that historically, this was usually an HTTP request which might provide language negotiation data through a dictionary interface. [alvinyue] Bugfixes: - Fixed import alias issue which would lead to a syntax error in generated Python code. Fixes issue #114. 2.8.5 (2012-05-02) ------------------ Bugfixes: - Fixed minor installation issues on Python 2.5 and 3. [ppaez] - Ensure output is unicode even when trivial (an empty string). 2.8.4 (2012-04-18) ------------------ Features: - In exception output, long filenames are now truncated to 60 characters of output, preventing line wrap which makes it difficult to scan the exception output. Bugfixes: - Include filename and location in exception output for exceptions raised during compilation. - If a trivial translation substitution variable is given (i.e. an empty string), simply ignore it. This fixes issue #106. 2.8.3 (2012-04-16) ------------------ Features: - Log template source on debug-level before cooking. - The `target_language` argument, if given, is now available as a variable in templates. 2.8.2 (2012-03-30) ------------------ Features: - Temporary caches used in debug mode are cleaned up eagerly, rather than waiting for process termination. [mitchellrj] Bugfixes: - The `index`, `start` and `end` methods on the TAL repeat object are now callable. This fixes an incompatibility with ZPT. - The loader now correctly handles absolute paths on Windows. [rdale] 2.8.1 (2012-03-29) ------------------ Features: - The exception formatter now lists errors in 'wrapping order'. This means that the innermost, and presumably most relevant exception is shown last. Bugfixes: - The exception formatter now correctly recognizes nested errors and does not rewrap the dynamically generated exception class. - The exception formatter now correctly sets the ``__module__`` attribute to that of the original exception class. 2.8.0 (2012-02-29) ------------------ Features: - Added support for code blocks using the `<?python ... ?>` processing instruction syntax. The scope is name assignments is up until the nearest macro definition, or the template itself if macros are not used. Bugfixes: - Fall back to the exception class' ``__new__`` method to safely create an exception object that is not implemented in Python. - The exception formatter now keeps track of already formatted exceptions, and ignores them from further output. 2.7.4 (2012-02-27) ------------------ - The error handler now invokes the ``__init__`` method of ``BaseException`` instead of the possibly overriden method (which may take required arguments). This fixes issue #97. [j23d, malthe] 2.7.3 (2012-01-16) ------------------ Bugfixes: - The trim whitespace option now correctly trims actual whitespace to a single character, appearing either to the left or to the right of an element prefix or suffix string. 2.7.2 (2012-01-08) ------------------ Features: - Added option ``trim_attribute_space`` that decides whether attribute whitespace is stripped (at most down to a single space). This option exists to provide compatibility with the reference implementation. Fixes issue #85. Bugfixes: - Ignore unhashable builtins when generating a reverse builtin map to quickly look up a builtin value. [malthe] - Apply translation mapping even when a translation function is not available. This fixes issue #83. [malthe] - Fixed issue #80. The translation domain for a slot is defined by the source document, i.e. the template providing the content for a slot whether it be the default or provided through ``metal:fill-slot``. [jcbrand] - In certain circumstances, a Unicode non-breaking space character would cause a define clause to fail to parse. 2.7.1 (2011-12-29) ------------------ Features: - Enable expression interpolation in CDATA. - The page template class now implements dictionary access to macros:: template[name] This is a short-hand for:: template.macros[name] Bugfixes: - An invalid define clause would be silently ignored; we now raise a language error exception. This fixes issue #79. - Fixed regression where ``${...}`` interpolation expressions could not span multiple lines. This fixes issue #77. 2.7.0 (2011-12-13) ------------------ Features: - The ``load:`` expression now derives from the string expression such that the ``${...}`` operator can be used for expression interpolation. - The ``load:`` expression now accepts asset specs; these are resolved by the ``pkg_resources.resource_filename`` function:: <package_name>:<path> An example from the test suite:: chameleon:tests/inputs/hello_world.pt Bugfixes: - If an attribute name for translation was not a valid Python identifier, the compiler would generate invalid code. This has been fixed, and the compiler now also throws an exception if an attribute specification contains a comma. (Note that the only valid separator character is the semicolon, when specifying attributes for translation via the ``i18n:translate`` statement). This addresses issue #76. 2.6.2 (2011-12-08) ------------------ Bugfixes: - Fixed issue where ``tal:on-error`` would not respect ``tal:omit-tag`` or namespace elements which are omitted by default (such as ``<tal:block />``). - Fixed issue where ``macros`` attribute would not be available on file-based templates due to incorrect initialization. - The ``TryExcept`` and ``TryFinally`` AST nodes are not available on Python 3.3. These have been aliased to ``Try``. This fixes issue #75. Features: - The TAL repeat item now makes a security declaration that grants access to unprotected subobjects on the Zope 2 platform:: __allow_access_to_unprotected_subobjects__ = True This is required for legacy compatibility and does not affect other environments. - The template object now has a method ``write(body)`` which explicitly decodes and cooks a string input. - Added configuration option ``loader_class`` which sets the class used to create the template loader object. The class (essentially a callable) is created at template construction time. 2.6.1 (2011-11-30) ------------------ Bugfixes: - Decode HTML entities in expression interpolation strings. This fixes issue #74. - Allow ``xml`` and ``xmlns`` attributes on TAL, I18N and METAL namespace elements. This fixes issue #73. 2.6.0 (2011-11-24) ------------------ Features: - Added support for implicit translation: The ``implicit_i18n_translate`` option enables implicit translation of text. The ``implicit_i18n_attributes`` enables implicit translation of attributes. The latter must be a set and for an attribute to be implicitly translated, its lowercase string value must be included in the set. - Added option ``strict`` (enabled by default) which decides whether expressions are required to be valid at compile time. That is, if not set, an exception is only raised for an invalid expression at evaluation time. - An expression error now results in an exception only if the expression is attempted evaluated during a rendering. - Added a configuration option ``prepend_relative_search_path`` which decides whether the path relative to a file-based template is prepended to the load search path. The default is ``True``. - Added a configuration option ``search_path`` to the file-based template class, which adds additional paths to the template load instance bound to the ``load:`` expression. The option takes a string path or an iterable yielding string paths. The default value is the empty set. Bugfixes: - Exception instances now support pickle/unpickle. - An attributes in i18n:attributes no longer needs to match an existing or dynamic attribute in order to appear in the element. This fixes issue #66. 2.5.3 (2011-10-23) ------------------ Bugfixes: - Fixed an issue where a nested macro slot definition would fail even though there existed a parent macro definition. This fixes issue #69. 2.5.2 (2011-10-12) ------------------ Bugfixes: - Fixed an issue where technically invalid input would result in a compiler error. Features: - The markup class now inherits from the unicode string type such that it's compatible with the string interface. 2.5.1 (2011-09-29) ------------------ Bugfixes: - The symbol names "convert", "decode" and "translate" are now no longer set as read-only *compiler internals*. This fixes issue #65. - Fixed an issue where a macro extension chain nested two levels (a template uses a macro that extends a macro) would lose the middle slot definitions if slots were defined nested. The compiler now throws an error if a nested slot definition is used outside a macro extension context. 2.5.0 (2011-09-23) ------------------ Features: - An expression type ``structure:`` is now available which wraps the expression result as *structure* such that it is not escaped on insertion, e.g.:: <div id="content"> ${structure: context.body} </div> This also means that the ``structure`` keyword for ``tal:content`` and ``tal:replace`` now has an alternative spelling via the expression type ``structure:``. - The string-based template constructor now accepts encoded input. 2.4.6 (2011-09-23) ------------------ Bugfixes: - The ``tal:on-error`` statement should catch all exceptions. - Fixed issue that would prevent escaping of interpolation expression values appearing in text. 2.4.5 (2011-09-21) ------------------ Bugfixes: - The ``tal:on-error`` handler should have a ``error`` variable defined that has the value of the exception thrown. - The ``tal:on-error`` statement is a substitution statement and should support the "text" and "structure" insertion methods. 2.4.4 (2011-09-15) ------------------ Bugfixes: - An encoding specified in the XML document preamble is now read and used to decode the template input to unicode. This fixes issue #55. - Encoded expression input on Python 3 is now correctly decoded. Previously, the string representation output would be included instead of an actually decoded string. - Expression result conversion steps are now correctly included in error handling such that the exception output points to the expression location. 2.4.3 (2011-09-13) ------------------ Features: - When an encoding is provided, pass the 'ignore' flag to avoid decoding issues with bad input. Bugfixes: - Fixed pypy compatibility issue (introduced in previous release). 2.4.2 (2011-09-13) ------------------ Bugfixes: - Fixed an issue in the compiler where an internal variable (such as a translation default value) would be cached, resulting in variable scope corruption (see issue #49). 2.4.1 (2011-09-08) ------------------ Bugfixes: - Fixed an issue where a default value for an attribute would sometimes spill over into another attribute. - Fixed issue where the use of the ``default`` name in an attribute interpolation expression would print the attribute value. This is unexpected, because it's an expression, not a static text suitable for output. An attribute value of ``default`` now correctly drops the attribute. 2.4.0 (2011-08-22) ------------------ Features: - Added an option ``boolean_attributes`` to evaluate and render a provided set of attributes using a boolean logic: if the attribute is a true value, the value will be the attribute name, otherwise the attribute is dropped. In the reference implementation, the following attributes are configured as boolean values when the template is rendered in HTML-mode:: "compact", "nowrap", "ismap", "declare", "noshade", "checked", "disabled", "readonly", "multiple", "selected", "noresize", "defer" Note that in Chameleon, these attributes must be manually provided. Bugfixes: - The carriage return character (used on Windows platforms) would incorrectly be included in Python comments. It is now replaced with a line break. This fixes issue #44. 2.3.8 (2011-08-19) ------------------ - Fixed import error that affected Python 2.5 only. 2.3.7 (2011-08-19) ------------------ Features: - Added an option ``literal_false`` that disables the default behavior of dropping an attribute for a value of ``False`` (in addition to ``None``). This modified behavior is the behavior exhibited in reference implementation. Bugfixes: - Undo attribute special HTML attribute behavior (see previous release). This turned out not to be a compatible behavior; rather, boolean values should simply be coerced to a string. Meanwhile, the reference implementation does support an HTML mode in which the special attribute behavior is exhibited. We do not currently support this mode. 2.3.6 (2011-08-18) ------------------ Features: - Certain HTML attribute names now have a special behavior for a attribute value of ``True`` (or ``default`` if no default is defined). For these attributes, this return value will result in the name being printed as the value:: <input type="input" tal:attributes="checked True" /> will be rendered as:: <input type="input" checked="checked" /> This behavior is compatible with the reference implementation. 2.3.5 (2011-08-18) ------------------ Features: - Added support for the set operator (``{item, item, ...}``). Bugfixes: - If macro is defined on the same element as a translation name, this no longer results in a "translation name not allowed outside translation" error. This fixes issue #43. - Attribute fallback to dictionary lookup now works on multiple items (e.g. ``d1.d2.d2``). This fixes issue #42. 2.3.4 (2011-08-16) ------------------ Features: - When inserting content in either attributes or text, a value of ``True`` (like ``False`` and ``None``) will result in no action. - Use statically assigned variables for ``"attrs"`` and ``"default"``. This change yields a performance improvement of 15-20%. - The template loader class now accepts an optional argument ``default_extension`` which accepts a filename extension which will be appended to the filename if there's not already an extension. Bugfixes: - The default symbol is now ``True`` for an attribute if the attribute default is not provided. Note that the result is that the attribute is dropped. This fixes issue #41. - Fixed an issue where assignment to a variable ``"type"`` would fail. This fixes issue #40. - Fixed an issue where an (unsuccesful) assignment for a repeat loop to a compiler internal name would not result in an error. - If the translation function returns the identical object, manually coerce it to string. This fixes a compatibility issue with translation functions which do not convert non-string objects to a string value, but simply return them unchanged. 2.3.3 (2011-08-15) ------------------ Features: - The ``load:`` expression now passes the initial keyword arguments to its template loader (e.g. ``auto_reload`` and ``encoding``). - In the exception output, string variable values are now limited to a limited output of characters, single line only. Bugfixes: - Fixed horizontal alignment of exception location info (i.e. 'String:', 'Filename:' and 'Location:') such that they match the template exception formatter. 2.3.2 (2011-08-11) ------------------ Bugfixes: - Fixed issue where i18n:domain would not be inherited through macros and slots. This fixes issue #37. 2.3.1 (2011-08-11) ------------------ Features: - The ``Builtin`` node type may now be used to represent any Python local or global name. This allows expression compilers to refer to e.g. ``get`` or ``getitem``, or to explicit require a builtin object such as one from the ``extra_builtins`` dictionary. Bugfixes: - Builtins which are not explicitly disallowed may now be redefined and used as variables (e.g. ``nothing``). - Fixed compiler issue with circular node annotation loop. 2.3 (2011-08-10) ---------------- Features: - Added support for the following syntax to disable inline evaluation in a comment: <!--? comment appears verbatim (no ${...} evaluation) --> Note that the initial question mark character (?) will be omitted from output. - The parser now accepts '<' and '>' in attributes. Note that this is invalid markup. Previously, the '<' would not be accepted as a valid attribute value, but this would result in an 'unexpected end tag' error elsewhere. This fixes issue #38. - The expression compiler now provides methods ``assign_text`` and ``assign_value`` such that a template engine might configure this value conversion to support e.g. encoded strings. Note that currently, the only client for the ``assign_text`` method is the string expression type. - Enable template loader for string-based template classes. Note that the ``filename`` keyword argument may be provided on initialization to identify the template source by filename. This fixes issue #36. - Added ``extra_builtins`` option to the page template class. These builtins are added to the default builtins dictionary at cook time and may be provided at initialization using the ``extra_builtins`` keyword argument. Bugfixes: - If a translation domain is set for a fill slot, use this setting instead of the macro template domain. - The Python expression compiler now correctly decodes HTML entities ``'gt'`` and ``'lt'``. This fixes issue #32. - The string expression compiler now correctly handles encoded text (when support for encoded strings is enabled). This fixes issue #35. - Fixed an issue where setting the ``filename`` attribute on a file-based template would not automatically cause an invalidation. - Exceptions raised by Chameleon can now be copied via ``copy.copy``. This fixes issue #36. [leorochael] - If copying the exception fails in the exception handler, simply re-raise the original exception and log a warning. 2.2 (2011-07-28) ---------------- Features: - Added new expression type ``load:`` that allows loading a template. Both relative and absolute paths are supported. If the path given is relative, then it will be resolved with respect to the directory of the template. - Added support for dynamic evaluation of expressions. Note that this is to support legacy applications. It is not currently wired into the provided template classes. - Template classes now have a ``builtins`` attribute which may be used to define built-in variables always available in the template variable scope. Incompatibilities: - The file-based template class no longer accepts a parameter ``loader``. This parameter would be used to load a template from a relative path, using a ``find(filename)`` method. This was however, undocumented, and probably not very useful since we have the ``TemplateLoader`` mechanism already. - The compiled template module now contains an ``initialize`` function which takes values that map to the template builtins. The return value of this function is a dictionary that contains the render functions. Bugfixes: - The file-based template class no longer verifies the existance of a template file (using ``os.lstat``). This now happens implicitly if eager parsing is enabled, or otherwise when first needed (e.g. at render time). This is classified as a bug fix because the previous behavior was probably not what you'd expect, especially if an application initializes a lot of templates without needing to render them immediately. 2.1.1 (2011-07-28) ------------------ Features: - Improved exception display. The expression string is now shown in the context of the original source (if available) with a marker string indicating the location of the expression in the template source. Bugfixes: - The ``structure`` insertion mode now correctly decodes entities for any expression type (including ``string:``). This fixes issue #30. - Don't show internal variables in the exception formatter variable listing. 2.1 (2011-07-25) ---------------- Features: - Expression interpolation (using the ``${...}`` operator and previously also ``$identifier``) now requires braces everywhere except inside the ``string:`` expression type. This change is motivated by a number of legacy templates in which the interpolation format without braces ``$identifier`` appears as text. 2.0.2 (2011-07-25) ------------------ Bugfixes: - Don't use dynamic variable scope for lambda-scoped variables (#27). - Avoid duplication of exception class and message in traceback. - Fixed issue where a ``metal:fill-slot`` would be ignored if a macro was set to be used on the same element (#16). 2.0.1 (2011-07-23) ------------------ Bugfixes: - Fixed issue where global variable definition from macro slots would fail (they would instead be local). This also affects error reporting from inside slots because this would be recorded internally as a global. - Fixed issue with template cache digest (used for filenames); modules are now invalidated whenever any changes are made to the distribution set available (packages on ``sys.path``). - Fixed exception handler to better let exceptions propagate through the renderer. - The disk-based module compiler now mangles template source filenames such that the output Python module is valid and at root level (dots and hyphens are replaced by an underscore). This fixes issue #17. - Fixed translations (i18n) on Python 2.5. 2.0 (2011-07-14) ---------------- - Point release. 2.0-rc14 (2011-07-13) --------------------- Bugfixes: - The tab character (``\t``) is now parsed correctly when used inside tags. Features: - The ``RepeatDict`` class now works as a proxy behind a seperate dictionary instance. - Added template constructor option ``keep_body`` which is a flag (also available as a class attribute) that controls whether to save the template body input in the ``body`` attribute. This is disabled by default, unless debug-mode is enabled. - The page template loader class now accepts an optional ``formats`` argument which can be used to select an alternative template class. 2.0-rc13 (2011-07-07) --------------------- Bugfixes: - The backslash character (followed by optional whitespace and a line break) was not correctly interpreted as a continuation for Python expressions. Features: - The Python expression implementation is now more flexible for external subclassing via a new ``parse`` method. 2.0-rc12 (2011-07-04) --------------------- Bugfixes: - Initial keyword arguments passed to a template now no longer "leak" into the template variable space after a macro call. - An unexpected end tag is now an unrecoverable error. Features: - Improve exception output. 2.0-rc11 (2011-05-26) --------------------- Bugfixes: - Fixed issue where variable names that begin with an underscore were seemingly allowed, but their use resulted in a compiler error. Features: - Template variable names are now allowed to be prefixed with a single underscore, but not two or more (reserved for internal use). Examples of valid names:: item ITEM _item camelCase underscore_delimited help - Added support for Genshi's comment "drop" syntax:: <!--! This comment will be dropped --> Note the additional exclamation (!) character. This fixes addresses issue #10. 2.0-rc10 (2011-05-24) --------------------- Bugfixes: - The ``tal:attributes`` statement now correctly operates case-insensitive. The attribute name given in the statement will replace an existing attribute with the same name, without respect to case. Features: - Added ``meta:interpolation`` statement to control expression interpolation setting. Strings that disable the setting: ``"off"`` and ``"false"``. Strings that enable the setting: ``"on"`` and ``"true"``. - Expression interpolation now works inside XML comments. 2.0-rc9 (2011-05-05) -------------------- Features: - Better debugging support for string decode and conversion. If a naive join fails, each element in the output will now be attempted coerced to unicode to try and trigger the failure near to the bad string. 2.0-rc8 (2011-04-11) -------------------- Bugfixes: - If a macro defines two slots with the same name, a caller will now fill both with a single usage. - If a valid of ``None`` is provided as the translation function argument, we now fall back to the class default. 2.0-rc7 (2011-03-29) -------------------- Bugfixes: - Fixed issue with Python 2.5 compatibility AST. This affected at least PyPy 1.4. Features: - The ``auto_reload`` setting now defaults to the class value; the base template class gives a default value of ``chameleon.config.AUTO_RELOAD``. This change allows a subclass to provide a custom default value (such as an application-specific debug mode setting). 2.0-rc6 (2011-03-19) -------------------- Features: - Added support for ``target_language`` keyword argument to render method. If provided, the argument will be curried onto the translation function. Bugfixes: - The HTML entities 'lt', 'gt' and 'quot' appearing inside content subtition expressions are now translated into their native character values. This fixes an issue where you could not dynamically create elements using the ``structure`` (which is possible in ZPT). The need to create such structure stems from the lack of an expression interpolation operator in ZPT. - Fixed duplicate file pointer issue with test suite (affected Windows platforms only). This fixes issue #9. [oliora] - Use already open file using ``os.fdopen`` when trying to write out the module source. This fixes LP #731803. 2.0-rc5 (2011-03-07) -------------------- Bugfixes: - Fixed a number of issues concerning the escaping of attribute values: 1) Static attribute values are now included as they appear in the source. This means that invalid attribute values such as ``"true && false"`` are now left alone. It's not the job of the template engine to correct such markup, at least not in the default mode of operation. 2) The string expression compiler no longer unescapes values. Instead, this is left to each expression compiler. Currently only the Python expression compiler unescapes its input. 3) The dynamic escape code sequence now correctly only replaces ampersands that are part of an HTML escape format. Imports: - The page template classes and the loader class can now be imported directly from the ``chameleon`` module. Features: - If a custom template loader is not provided, relative paths are now resolved using ``os.abspath`` (i.e. to the current working directory). - Absolute paths are normalized using ``os.path.normpath`` and ``os.path.expanduser``. This ensures that all paths are kept in their "canonical" form. 2.0-rc4 (2011-03-03) -------------------- Bugfixes: - Fixed an issue where the output of an end-to-end string expression would raise an exception if the expression evaluated to ``None`` (it should simply output nothing). - The ``convert`` function (which is configurable on the template class level) now defaults to the ``translate`` function (at run-time). This fixes an issue where message objects were not translated (and thus converted to a string) using the a provided ``translate`` function. - Fixed string interpolation issue where an expression immediately succeeded by a right curly bracket would not parse. This fixes issue #5. - Fixed error where ``tal:condition`` would be evaluated after ``tal:repeat``. Features: - Python expression is now a TALES expression. That means that the pipe operator can be used to chain two or more expressions in a try-except sequence. This behavior was ported from the 1.x series. Note that while it's still possible to use the pipe character ("|") in an expression, it must now be escaped. - The template cache can now be shared by multiple processes. 2.0-rc3 (2011-03-02) -------------------- Bugfixes: - Fixed ``atexit`` handler. This fixes issue #3. - If a cache directory is specified, it will now be used even when not in debug mode. - Allow "comment" attribute in the TAL namespace. This fixes an issue in the sense that the reference engine allows any attribute within the TAL namespace. However, only "comment" is in common use. - The template constructor now accepts a flag ``debug`` which puts the template *instance* into debug-mode regardless of the global setting. This fixes issue #1. Features: - Added exception handler for exceptions raised while evaluating an expression. This handler raises (or attempts to) a new exception of the type ``RenderError``, with an additional base class of the original exception class. The string value of the exception is a formatted error message which includes the expression that caused the exception. If we are unable to create the exception class, the original exception is re-raised. 2.0-rc2 (2011-02-28) -------------------- - Fixed upload issue. 2.0-rc1 (2011-02-28) -------------------- - Initial public release. See documentation for what's new in this series. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.1 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 �����������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/Chameleon.egg-info/SOURCES.txt���������������������������������������������������0000644�0001750�0000144�00000041756�12614070273�022044� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������.gitignore .travis.yml CHANGES.rst COPYRIGHT.txt LICENSE.txt MANIFEST.in Makefile README.rst setup.cfg setup.py tox.ini benchmarks/bm_chameleon.py benchmarks/bm_mako.py benchmarks/util.py docs/conf.py docs/configuration.rst docs/index.rst docs/integration.rst docs/library.rst docs/reference.rst docs/requirements.txt src/Chameleon.egg-info/PKG-INFO src/Chameleon.egg-info/SOURCES.txt src/Chameleon.egg-info/dependency_links.txt src/Chameleon.egg-info/not-zip-safe src/Chameleon.egg-info/top_level.txt src/chameleon/__init__.py src/chameleon/ast25.py src/chameleon/astutil.py src/chameleon/benchmark.py src/chameleon/codegen.py src/chameleon/compiler.py src/chameleon/config.py src/chameleon/exc.py src/chameleon/i18n.py src/chameleon/interfaces.py src/chameleon/loader.py src/chameleon/metal.py src/chameleon/namespaces.py src/chameleon/nodes.py src/chameleon/parser.py src/chameleon/program.py src/chameleon/py25.py src/chameleon/py26.py src/chameleon/tal.py src/chameleon/tales.py src/chameleon/template.py src/chameleon/tokenize.py src/chameleon/utils.py src/chameleon/tests/__init__.py src/chameleon/tests/test_doctests.py src/chameleon/tests/test_exc.py src/chameleon/tests/test_loader.py src/chameleon/tests/test_parser.py src/chameleon/tests/test_sniffing.py src/chameleon/tests/test_templates.py src/chameleon/tests/test_tokenizer.py src/chameleon/tests/inputs/001-interpolation.txt src/chameleon/tests/inputs/001-interpolation.txt.py src/chameleon/tests/inputs/001-variable-scope.html src/chameleon/tests/inputs/001-variable-scope.pt src/chameleon/tests/inputs/001-variable-scope.pt.py src/chameleon/tests/inputs/001.xml src/chameleon/tests/inputs/002-repeat-scope.pt src/chameleon/tests/inputs/002-repeat-scope.pt.py src/chameleon/tests/inputs/002.xml src/chameleon/tests/inputs/003-content.pt src/chameleon/tests/inputs/003-content.pt.py src/chameleon/tests/inputs/003.xml src/chameleon/tests/inputs/004-attributes.pt src/chameleon/tests/inputs/004-attributes.pt.py src/chameleon/tests/inputs/004.xml src/chameleon/tests/inputs/005-default.pt src/chameleon/tests/inputs/005-default.pt.py src/chameleon/tests/inputs/005.xml src/chameleon/tests/inputs/006-attribute-interpolation.pt src/chameleon/tests/inputs/006-attribute-interpolation.pt.py src/chameleon/tests/inputs/006.xml src/chameleon/tests/inputs/007-content-interpolation.pt src/chameleon/tests/inputs/007-content-interpolation.pt.py src/chameleon/tests/inputs/007.xml src/chameleon/tests/inputs/008-builtins.pt src/chameleon/tests/inputs/008-builtins.pt.py src/chameleon/tests/inputs/008.xml src/chameleon/tests/inputs/009-literals.pt src/chameleon/tests/inputs/009-literals.pt.py src/chameleon/tests/inputs/009.xml src/chameleon/tests/inputs/010-structure.pt src/chameleon/tests/inputs/010-structure.pt.py src/chameleon/tests/inputs/010.xml src/chameleon/tests/inputs/011-messages.pt src/chameleon/tests/inputs/011-messages.pt-en.py src/chameleon/tests/inputs/011-messages.pt.py src/chameleon/tests/inputs/011.xml src/chameleon/tests/inputs/012-translation.pt src/chameleon/tests/inputs/012-translation.pt-en.py src/chameleon/tests/inputs/012-translation.pt.py src/chameleon/tests/inputs/012.xml src/chameleon/tests/inputs/013-repeat-nested.pt src/chameleon/tests/inputs/013-repeat-nested.pt.py src/chameleon/tests/inputs/013.xml src/chameleon/tests/inputs/014-repeat-nested-similar.pt src/chameleon/tests/inputs/014-repeat-nested-similar.pt.py src/chameleon/tests/inputs/014.xml src/chameleon/tests/inputs/015-translation-nested.pt src/chameleon/tests/inputs/015-translation-nested.pt-en.py src/chameleon/tests/inputs/015-translation-nested.pt.py src/chameleon/tests/inputs/015.xml src/chameleon/tests/inputs/016-explicit-translation.pt src/chameleon/tests/inputs/016-explicit-translation.pt-en.py src/chameleon/tests/inputs/016-explicit-translation.pt.py src/chameleon/tests/inputs/016.xml src/chameleon/tests/inputs/017-omit-tag.pt src/chameleon/tests/inputs/017-omit-tag.pt.py src/chameleon/tests/inputs/017.xml src/chameleon/tests/inputs/018-translation-nested-dynamic.pt src/chameleon/tests/inputs/018-translation-nested-dynamic.pt-en.py src/chameleon/tests/inputs/018-translation-nested-dynamic.pt.py src/chameleon/tests/inputs/018.xml src/chameleon/tests/inputs/019-replace.pt src/chameleon/tests/inputs/019-replace.pt.py src/chameleon/tests/inputs/019.xml src/chameleon/tests/inputs/020-on-error.pt src/chameleon/tests/inputs/020-on-error.pt.py src/chameleon/tests/inputs/020.xml src/chameleon/tests/inputs/021-translation-domain.pt src/chameleon/tests/inputs/021-translation-domain.pt-en.py src/chameleon/tests/inputs/021-translation-domain.pt.py src/chameleon/tests/inputs/021.xml src/chameleon/tests/inputs/022-switch.pt src/chameleon/tests/inputs/022-switch.pt.py src/chameleon/tests/inputs/022.xml src/chameleon/tests/inputs/023-condition.pt src/chameleon/tests/inputs/023-condition.pt.py src/chameleon/tests/inputs/023.xml src/chameleon/tests/inputs/024-namespace-elements.pt src/chameleon/tests/inputs/024-namespace-elements.pt.py src/chameleon/tests/inputs/024.xml src/chameleon/tests/inputs/025-repeat-whitespace.pt src/chameleon/tests/inputs/025-repeat-whitespace.pt.py src/chameleon/tests/inputs/025.xml src/chameleon/tests/inputs/026-repeat-variable.pt src/chameleon/tests/inputs/026-repeat-variable.pt.py src/chameleon/tests/inputs/026.xml src/chameleon/tests/inputs/027-attribute-replacement.pt src/chameleon/tests/inputs/027-attribute-replacement.pt.py src/chameleon/tests/inputs/027.xml src/chameleon/tests/inputs/028-attribute-toggle.pt src/chameleon/tests/inputs/028-attribute-toggle.pt.py src/chameleon/tests/inputs/028.xml src/chameleon/tests/inputs/029-attribute-ordering.pt src/chameleon/tests/inputs/029-attribute-ordering.pt.py src/chameleon/tests/inputs/029.xml src/chameleon/tests/inputs/030-repeat-tuples.pt src/chameleon/tests/inputs/030-repeat-tuples.pt.py src/chameleon/tests/inputs/030.xml src/chameleon/tests/inputs/031-namespace-with-tal.pt src/chameleon/tests/inputs/031-namespace-with-tal.pt.py src/chameleon/tests/inputs/031.xml src/chameleon/tests/inputs/032-master-template.pt src/chameleon/tests/inputs/032-master-template.pt.py src/chameleon/tests/inputs/032.xml src/chameleon/tests/inputs/033-use-macro-trivial.pt src/chameleon/tests/inputs/033-use-macro-trivial.pt.py src/chameleon/tests/inputs/033.xml src/chameleon/tests/inputs/034-use-template-as-macro.pt src/chameleon/tests/inputs/034-use-template-as-macro.pt.py src/chameleon/tests/inputs/034.xml src/chameleon/tests/inputs/035-use-macro-with-fill-slot.pt src/chameleon/tests/inputs/035-use-macro-with-fill-slot.pt.py src/chameleon/tests/inputs/035.xml src/chameleon/tests/inputs/036-use-macro-inherits-dynamic-scope.pt src/chameleon/tests/inputs/036.xml src/chameleon/tests/inputs/037-use-macro-local-variable-scope.pt src/chameleon/tests/inputs/037.xml src/chameleon/tests/inputs/038-use-macro-globals.pt src/chameleon/tests/inputs/038.xml src/chameleon/tests/inputs/039-globals.pt src/chameleon/tests/inputs/039.xml src/chameleon/tests/inputs/040-macro-using-template-symbol.pt src/chameleon/tests/inputs/040.xml src/chameleon/tests/inputs/041-translate-nested-names.pt src/chameleon/tests/inputs/041.xml src/chameleon/tests/inputs/042-use-macro-fill-footer.pt src/chameleon/tests/inputs/042.xml src/chameleon/tests/inputs/043-macro-nested-dynamic-vars.pt src/chameleon/tests/inputs/043.xml src/chameleon/tests/inputs/044-tuple-define.pt src/chameleon/tests/inputs/044.xml src/chameleon/tests/inputs/045-namespaces.pt src/chameleon/tests/inputs/045.xml src/chameleon/tests/inputs/046-extend-macro.pt src/chameleon/tests/inputs/046.xml src/chameleon/tests/inputs/047-use-extended-macro.pt src/chameleon/tests/inputs/047.xml src/chameleon/tests/inputs/048-use-extended-macro-fill-original.pt src/chameleon/tests/inputs/048.xml src/chameleon/tests/inputs/049-entities-in-attributes.pt src/chameleon/tests/inputs/049.xml src/chameleon/tests/inputs/050-define-macro-and-use-not-extend.pt src/chameleon/tests/inputs/050.xml src/chameleon/tests/inputs/051-use-non-extended-macro.pt src/chameleon/tests/inputs/051.xml src/chameleon/tests/inputs/052-i18n-domain-inside-filled-slot.pt src/chameleon/tests/inputs/052.xml src/chameleon/tests/inputs/053-special-characters-in-attributes.pt src/chameleon/tests/inputs/053.xml src/chameleon/tests/inputs/054-import-expression.pt src/chameleon/tests/inputs/054.xml src/chameleon/tests/inputs/055-attribute-fallback-to-dict-lookup.pt src/chameleon/tests/inputs/055.xml src/chameleon/tests/inputs/056-comment-attribute.pt src/chameleon/tests/inputs/056.xml src/chameleon/tests/inputs/057-order.pt src/chameleon/tests/inputs/057.xml src/chameleon/tests/inputs/058-script.pt src/chameleon/tests/inputs/058.xml src/chameleon/tests/inputs/059-embedded-javascript.pt src/chameleon/tests/inputs/059.xml src/chameleon/tests/inputs/060-macro-with-multiple-same-slots.pt src/chameleon/tests/inputs/060.xml src/chameleon/tests/inputs/061-fill-one-slot-but-two-defined.pt src/chameleon/tests/inputs/061.xml src/chameleon/tests/inputs/062-comments-and-expressions.pt src/chameleon/tests/inputs/062.xml src/chameleon/tests/inputs/063-continuation.pt src/chameleon/tests/inputs/063.xml src/chameleon/tests/inputs/064-tags-and-special-characters.pt src/chameleon/tests/inputs/064.xml src/chameleon/tests/inputs/065-use-macro-in-fill.pt src/chameleon/tests/inputs/065.xml src/chameleon/tests/inputs/066-load-expression.pt src/chameleon/tests/inputs/066.xml src/chameleon/tests/inputs/067-attribute-decode.pt src/chameleon/tests/inputs/067.xml src/chameleon/tests/inputs/068-less-than-greater-than-in-attributes.pt src/chameleon/tests/inputs/068.xml src/chameleon/tests/inputs/069-translation-domain-and-macro.pt src/chameleon/tests/inputs/069.xml src/chameleon/tests/inputs/070-translation-domain-and-use-macro.pt src/chameleon/tests/inputs/070.xml src/chameleon/tests/inputs/071-html-attribute-defaults.pt src/chameleon/tests/inputs/071.xml src/chameleon/tests/inputs/072-repeat-interpolation.pt src/chameleon/tests/inputs/072.xml src/chameleon/tests/inputs/073-utf8-encoded.pt src/chameleon/tests/inputs/073.xml src/chameleon/tests/inputs/074-encoded-template.pt src/chameleon/tests/inputs/074.xml src/chameleon/tests/inputs/075-nested-macros.pt src/chameleon/tests/inputs/075.xml src/chameleon/tests/inputs/076-nested-macro-override.pt src/chameleon/tests/inputs/076.xml src/chameleon/tests/inputs/077-i18n-attributes.pt src/chameleon/tests/inputs/077.xml src/chameleon/tests/inputs/078-tags-and-newlines.pt src/chameleon/tests/inputs/078.xml src/chameleon/tests/inputs/079-implicit-i18n.pt src/chameleon/tests/inputs/079.xml src/chameleon/tests/inputs/080-xmlns-namespace-on-tal.pt src/chameleon/tests/inputs/080.xml src/chameleon/tests/inputs/081-load-spec.pt src/chameleon/tests/inputs/081.xml src/chameleon/tests/inputs/082-load-spec-computed.pt src/chameleon/tests/inputs/082.xml src/chameleon/tests/inputs/083-template-dict-to-macro.pt src/chameleon/tests/inputs/083.xml src/chameleon/tests/inputs/084-interpolation-in-cdata.pt src/chameleon/tests/inputs/084.xml src/chameleon/tests/inputs/085-nested-translation.pt src/chameleon/tests/inputs/085.xml src/chameleon/tests/inputs/086-self-closing.pt src/chameleon/tests/inputs/086.xml src/chameleon/tests/inputs/087-code-blocks.pt src/chameleon/tests/inputs/087.xml src/chameleon/tests/inputs/088-python-newlines.pt src/chameleon/tests/inputs/088.xml src/chameleon/tests/inputs/089-load-fallback.pt src/chameleon/tests/inputs/089.xml src/chameleon/tests/inputs/090-tuple-expression.pt src/chameleon/tests/inputs/090.xml src/chameleon/tests/inputs/091-repeat-none.pt src/chameleon/tests/inputs/091.xml src/chameleon/tests/inputs/092.xml src/chameleon/tests/inputs/093.xml src/chameleon/tests/inputs/094.xml src/chameleon/tests/inputs/095.xml src/chameleon/tests/inputs/096.xml src/chameleon/tests/inputs/097.xml src/chameleon/tests/inputs/098.xml src/chameleon/tests/inputs/099.xml src/chameleon/tests/inputs/100.xml src/chameleon/tests/inputs/101-unclosed-tags.html src/chameleon/tests/inputs/101.xml src/chameleon/tests/inputs/102-unquoted-attributes.html src/chameleon/tests/inputs/102.xml src/chameleon/tests/inputs/103-simple-attribute.html src/chameleon/tests/inputs/103.xml src/chameleon/tests/inputs/104.xml src/chameleon/tests/inputs/105.xml src/chameleon/tests/inputs/106.xml src/chameleon/tests/inputs/107.xml src/chameleon/tests/inputs/108.xml src/chameleon/tests/inputs/109.xml src/chameleon/tests/inputs/110.xml src/chameleon/tests/inputs/111.xml src/chameleon/tests/inputs/112.xml src/chameleon/tests/inputs/113.xml src/chameleon/tests/inputs/114.xml src/chameleon/tests/inputs/115.xml src/chameleon/tests/inputs/116.xml src/chameleon/tests/inputs/117.xml src/chameleon/tests/inputs/118.xml src/chameleon/tests/inputs/119.xml src/chameleon/tests/inputs/120-translation-context.pt src/chameleon/tests/inputs/121-translation-comment.pt src/chameleon/tests/inputs/122-translation-ignore.pt src/chameleon/tests/inputs/123-html5-data-attributes.pt src/chameleon/tests/inputs/greeting.pt src/chameleon/tests/inputs/hello_world.pt src/chameleon/tests/inputs/hello_world.txt src/chameleon/tests/inputs/hello_world.txt.py src/chameleon/tests/outputs/001.html src/chameleon/tests/outputs/001.pt src/chameleon/tests/outputs/001.txt src/chameleon/tests/outputs/002.pt src/chameleon/tests/outputs/003.pt src/chameleon/tests/outputs/004.pt src/chameleon/tests/outputs/005.pt src/chameleon/tests/outputs/006.pt src/chameleon/tests/outputs/007.pt src/chameleon/tests/outputs/008.pt src/chameleon/tests/outputs/009.pt src/chameleon/tests/outputs/010.pt src/chameleon/tests/outputs/011-en.pt src/chameleon/tests/outputs/011.pt src/chameleon/tests/outputs/012-en.pt src/chameleon/tests/outputs/012.pt src/chameleon/tests/outputs/013.pt src/chameleon/tests/outputs/014.pt src/chameleon/tests/outputs/015-en.pt src/chameleon/tests/outputs/015.pt src/chameleon/tests/outputs/016-en.pt src/chameleon/tests/outputs/016.pt src/chameleon/tests/outputs/017.pt src/chameleon/tests/outputs/018-en.pt src/chameleon/tests/outputs/018.pt src/chameleon/tests/outputs/019.pt src/chameleon/tests/outputs/020.pt src/chameleon/tests/outputs/021-en.pt src/chameleon/tests/outputs/021.pt src/chameleon/tests/outputs/022.pt src/chameleon/tests/outputs/023.pt src/chameleon/tests/outputs/024.pt src/chameleon/tests/outputs/025.pt src/chameleon/tests/outputs/026.pt src/chameleon/tests/outputs/027.pt src/chameleon/tests/outputs/028.pt src/chameleon/tests/outputs/029.pt src/chameleon/tests/outputs/030.pt src/chameleon/tests/outputs/031.pt src/chameleon/tests/outputs/032.pt src/chameleon/tests/outputs/033.pt src/chameleon/tests/outputs/034.pt src/chameleon/tests/outputs/035.pt src/chameleon/tests/outputs/036.pt src/chameleon/tests/outputs/037.pt src/chameleon/tests/outputs/038.pt src/chameleon/tests/outputs/039.pt src/chameleon/tests/outputs/040.pt src/chameleon/tests/outputs/041.pt src/chameleon/tests/outputs/042.pt src/chameleon/tests/outputs/043.pt src/chameleon/tests/outputs/044.pt src/chameleon/tests/outputs/045.pt src/chameleon/tests/outputs/046.pt src/chameleon/tests/outputs/047.pt src/chameleon/tests/outputs/048.pt src/chameleon/tests/outputs/049.pt src/chameleon/tests/outputs/050.pt src/chameleon/tests/outputs/051.pt src/chameleon/tests/outputs/052.pt src/chameleon/tests/outputs/053.pt src/chameleon/tests/outputs/054.pt src/chameleon/tests/outputs/055.pt src/chameleon/tests/outputs/056.pt src/chameleon/tests/outputs/057.pt src/chameleon/tests/outputs/058.pt src/chameleon/tests/outputs/059.pt src/chameleon/tests/outputs/060.pt src/chameleon/tests/outputs/061.pt src/chameleon/tests/outputs/062.pt src/chameleon/tests/outputs/063.pt src/chameleon/tests/outputs/064.pt src/chameleon/tests/outputs/065.pt src/chameleon/tests/outputs/066.pt src/chameleon/tests/outputs/067.pt src/chameleon/tests/outputs/068.pt src/chameleon/tests/outputs/069-en.pt src/chameleon/tests/outputs/069.pt src/chameleon/tests/outputs/070-en.pt src/chameleon/tests/outputs/070.pt src/chameleon/tests/outputs/071.pt src/chameleon/tests/outputs/072.pt src/chameleon/tests/outputs/073.pt src/chameleon/tests/outputs/074.pt src/chameleon/tests/outputs/075.pt src/chameleon/tests/outputs/076.pt src/chameleon/tests/outputs/077-en.pt src/chameleon/tests/outputs/077.pt src/chameleon/tests/outputs/078.pt src/chameleon/tests/outputs/079-en.pt src/chameleon/tests/outputs/079.pt src/chameleon/tests/outputs/080.pt src/chameleon/tests/outputs/081.pt src/chameleon/tests/outputs/082.pt src/chameleon/tests/outputs/083.pt src/chameleon/tests/outputs/084.pt src/chameleon/tests/outputs/085-en.pt src/chameleon/tests/outputs/085.pt src/chameleon/tests/outputs/086.pt src/chameleon/tests/outputs/087.pt src/chameleon/tests/outputs/088.pt src/chameleon/tests/outputs/089.pt src/chameleon/tests/outputs/090.pt src/chameleon/tests/outputs/091.pt src/chameleon/tests/outputs/101.html src/chameleon/tests/outputs/102.html src/chameleon/tests/outputs/103.html src/chameleon/tests/outputs/120-en.pt src/chameleon/tests/outputs/120.pt src/chameleon/tests/outputs/121.pt src/chameleon/tests/outputs/122.pt src/chameleon/tests/outputs/123.pt src/chameleon/tests/outputs/greeting.pt src/chameleon/tests/outputs/hello_world.pt src/chameleon/tests/outputs/hello_world.txt src/chameleon/zpt/__init__.py src/chameleon/zpt/loader.py src/chameleon/zpt/program.py src/chameleon/zpt/template.py������������������Chameleon-2.24/src/Chameleon.egg-info/dependency_links.txt������������������������������������������0000644�0001750�0000144�00000000001�12614070272�024210� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/Chameleon.egg-info/not-zip-safe��������������������������������������������������0000644�0001750�0000144�00000000001�11520513763�022372� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/Chameleon.egg-info/top_level.txt�������������������������������������������������0000644�0001750�0000144�00000000012�12614070272�022665� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������chameleon ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/�����������������������������������������������������������������������0000755�0001750�0000012�00000000000�12614070273�016446� 5����������������������������������������������������������������������������������������������������ustar �mborch��������������������������wheel���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/�����������������������������������������������������������������0000755�0001750�0000012�00000000000�12614070273�017610� 5����������������������������������������������������������������������������������������������������ustar �mborch��������������������������wheel���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/����������������������������������������������������������0000755�0001750�0000012�00000000000�12614070273�021132� 5����������������������������������������������������������������������������������������������������ustar �mborch��������������������������wheel���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/001-interpolation.txt�������������������������������������0000644�0001750�0000144�00000000026�11531710252�025114� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������${'<Hello world>'}<&> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/001-interpolation.txt.py����������������������������������0000600�0001750�0000144�00000003502�11547550677�025561� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') # <Expression u"'<Hello world>'" (1:2)> -> _content_139955154988272 try: _content_139955154988272 = '<Hello world>' except: rcontext.setdefault('__error__', []).append((u"'<Hello world>'", 1, 2, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is not None): _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = str(_content_139955154988272) else: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except AttributeError: _content_139955154988272 = convert(_content_139955154988272) else: _content_139955154988272 = _content_139955154988272() _content_139955154988272 = ('%s%s' % ((_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'<&>\n' if (u'<&>\n' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) pass����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/001-variable-scope.html�����������������������������������0000644�0001750�0000144�00000000163�11450127612�025252� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body py:with="text 'Hello world!'"> ${text} $text </body> ${text | 'Goodbye world!'} </html> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/001-variable-scope.pt�������������������������������������0000644�0001750�0000144�00000000317�11613337133�024734� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body tal:define="text 'Hello world!'"> ${text} </body> <tal:check condition="exists: text"> bad </tal:check> <tal:check condition="not: exists: text"> ok </tal:check> </html> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/001-variable-scope.pt.py����������������������������������0000600�0001750�0000144�00000021443�11547550676�025375� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_35706576 = {} _static_35782288 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35341232 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x221fe90> name=None at 221fb50> -> _value _value = _static_35782288 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_text_35704976 = get('text', _marker) # <Expression u"'Hello world!'" (2:25)> -> _value try: _value = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 2, 25, '<string>', _sys.exc_info()[1], )) raise econtext['text'] = _value _backup_attrs_35343320 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x220d6d0> name=None at 221f410> -> _value _value = _static_35706576 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') # <Expression u'text' (3:6)> -> _content_139955154988272 try: _content_139955154988272 = getitem('text') except: rcontext.setdefault('__error__', []).append((u'text', 3, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') # <Expression u'text' (4:5)> -> _content_139955154988272_65 try: _content_139955154988272_65 = getitem('text') except: rcontext.setdefault('__error__', []).append((u'text', 4, 5, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_65 is None): pass else: if (_content_139955154988272_65 is False): _content_139955154988272_65 = None else: _tt = type(_content_139955154988272_65) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_65 = unicode(_content_139955154988272_65) else: try: if (_tt is str): _content_139955154988272_65 = decode(_content_139955154988272_65) else: if (_tt is not unicode): try: _content_139955154988272_65 = _content_139955154988272_65.__html__ except: _content_139955154988272_65 = convert(_content_139955154988272_65) else: raise RuntimeError except RuntimeError: _content_139955154988272_65 = _content_139955154988272_65() else: if ((_content_139955154988272_65 is not None) and (re_needs_escape(_content_139955154988272_65) is not None)): if ('&' in _content_139955154988272_65): if (';' in _content_139955154988272_65): _content_139955154988272_65 = re_amp.sub('&', _content_139955154988272_65) else: _content_139955154988272_65 = _content_139955154988272_65.replace('&', '&') if ('<' in _content_139955154988272_65): _content_139955154988272_65 = _content_139955154988272_65.replace('<', '<') if ('>' in _content_139955154988272_65): _content_139955154988272_65 = _content_139955154988272_65.replace('>', '>') if ('\x00' in _content_139955154988272_65): _content_139955154988272_65 = _content_139955154988272_65.replace('\x00', '"') _content_139955154988272 = ('%s%s%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272_65 if (_content_139955154988272_65 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35343320 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35343320 if (_backup_text_35704976 is _marker): del econtext['text'] else: econtext['text'] = _backup_text_35704976 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'exists: text' (6:24)> -> _condition try: try: _ignore = getitem('text') except (AttributeError, LookupError, TypeError, NameError, KeyError, ): _condition = 0 else: _condition = 1 except: rcontext.setdefault('__error__', []).append((u'exists: text', 6, 24, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u'\n bad\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'not: exists: text' (9:24)> -> _condition try: try: _ignore = getitem('text') except (AttributeError, LookupError, TypeError, NameError, KeyError, ): _condition = 0 else: _condition = 1 _condition = not _condition except: rcontext.setdefault('__error__', []).append((u'not: exists: text', 9, 24, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u'\n ok\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35341232 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35341232 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/001.xml���������������������������������������������������0000644�0001750�0000144�00000000074�11445675021�022223� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/002-repeat-scope.pt���������������������������������������0000644�0001750�0000144�00000000331�11474511104�024421� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:repeat="text ('Hello', 'Goodbye')"> <span tal:repeat="char ('!', '.')">${text}${char}</span> </div> <tal:check condition="not: exists: text">ok</tal:check> </body> </html> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/002-repeat-scope.pt.py������������������������������������0000600�0001750�0000144�00000026412�11547550676�025072� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_35799760 = {} _static_35781456 = {} _static_35800848 = {} _static_35801104 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35876448 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224710> name=None at 220dc10> -> _value _value = _static_35800848 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35899944 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22242d0> name=None at 2224190> -> _value _value = _static_35799760 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_text_35782352 = get('text', _marker) # <Expression u"('Hello', 'Goodbye')" (3:26)> -> _iterator try: _iterator = ('Hello', 'Goodbye', ) except: rcontext.setdefault('__error__', []).append((u"('Hello', 'Goodbye')", 3, 26, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_35781840, ) = getitem('repeat')(u'text', _iterator) econtext['text'] = None for _item in _iterator: econtext['text'] = _item _backup_attrs_35900664 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224810> name=None at 2224a10> -> _value _value = _static_35801104 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_char_35801040 = get('char', _marker) # <Expression u"('!', '.')" (4:29)> -> _iterator try: _iterator = ('!', '.', ) except: rcontext.setdefault('__error__', []).append((u"('!', '.')", 4, 29, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_35780944, ) = getitem('repeat')(u'char', _iterator) econtext['char'] = None for _item in _iterator: econtext['char'] = _item _backup_attrs_35899800 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x221fb50> name=None at 221fbd0> -> _value _value = _static_35781456 econtext['attrs'] = _value # <span ... (4:6) # -------------------------------------------------------- append(u'<span>') # <Expression u'text' (4:43)> -> _content_139955154988272 try: _content_139955154988272 = getitem('text') except: rcontext.setdefault('__error__', []).append((u'text', 4, 43, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') # <Expression u'char' (4:50)> -> _content_139955154988272_113 try: _content_139955154988272_113 = getitem('char') except: rcontext.setdefault('__error__', []).append((u'char', 4, 50, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_113 is None): pass else: if (_content_139955154988272_113 is False): _content_139955154988272_113 = None else: _tt = type(_content_139955154988272_113) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_113 = unicode(_content_139955154988272_113) else: try: if (_tt is str): _content_139955154988272_113 = decode(_content_139955154988272_113) else: if (_tt is not unicode): try: _content_139955154988272_113 = _content_139955154988272_113.__html__ except: _content_139955154988272_113 = convert(_content_139955154988272_113) else: raise RuntimeError except RuntimeError: _content_139955154988272_113 = _content_139955154988272_113() else: if ((_content_139955154988272_113 is not None) and (re_needs_escape(_content_139955154988272_113) is not None)): if ('&' in _content_139955154988272_113): if (';' in _content_139955154988272_113): _content_139955154988272_113 = re_amp.sub('&', _content_139955154988272_113) else: _content_139955154988272_113 = _content_139955154988272_113.replace('&', '&') if ('<' in _content_139955154988272_113): _content_139955154988272_113 = _content_139955154988272_113.replace('<', '<') if ('>' in _content_139955154988272_113): _content_139955154988272_113 = _content_139955154988272_113.replace('>', '>') if ('\x00' in _content_139955154988272_113): _content_139955154988272_113 = _content_139955154988272_113.replace('\x00', '"') _content_139955154988272 = ('%s%s' % ((_content_139955154988272 if (_content_139955154988272 is not None) else ''), (_content_139955154988272_113 if (_content_139955154988272_113 is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_35899800 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35899800 __index_35780944 -= 1 if (__index_35780944 > 0): append('\n ') if (_backup_char_35801040 is _marker): del econtext['char'] else: econtext['char'] = _backup_char_35801040 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_35900664 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35900664 __index_35781840 -= 1 if (__index_35781840 > 0): append('\n ') if (_backup_text_35782352 is _marker): del econtext['text'] else: econtext['text'] = _backup_text_35782352 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'not: exists: text' (6:26)> -> _condition try: try: _ignore = getitem('text') except (AttributeError, LookupError, TypeError, NameError, KeyError, ): _condition = 0 else: _condition = 1 _condition = not _condition except: rcontext.setdefault('__error__', []).append((u'not: exists: text', 6, 26, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u'ok' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35899944 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35899944 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35876448 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35876448 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/002.xml���������������������������������������������������0000644�0001750�0000144�00000000075�11445675021�022225� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc ></doc> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/003-content.pt��������������������������������������������0000644�0001750�0000144�00000000772�12473423125�023523� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:content="'Hello world!'" /> <div tal:content="'Hello world!'" />1 2<div tal:content="'Hello world!'" /> <div tal:content="'Hello world!'" />3 <div tal:content="'Hello world!'">4</div>5 6<div tal:content="'Hello world!'"></div> <div tal:content="1" /> <div tal:content="1.0" /> <div tal:content="True" /> <div tal:content="False" /> <div tal:content="0" /> <div tal:content="None" /> <div tal:replace="content" /> </body> </html> ������Chameleon-2.24/src/chameleon/tests/inputs/003-content.pt.py�����������������������������������������0000600�0001750�0000144�00000130235�11547550676�024155� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_35889296 = {} _static_36669328 = {} _static_35932752 = {} _static_35780752 = {} _static_35829264 = {} _static_35830160 = {} _static_36668752 = {} _static_35800464 = {} _static_35829776 = {} _static_36669776 = {} _static_35831056 = {} _static_35932624 = {} _static_35883024 = {} _static_35889872 = {} _static_35882896 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_36729128 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2238790> name=None at 2238590> -> _value _value = _static_35882896 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36718280 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2244a50> name=None at 2244990> -> _value _value = _static_35932752 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36722808 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22449d0> name=None at 2244d50> -> _value _value = _static_35932624 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36723816 = get('default', _marker) # <Marker name='default' at 2244b90> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (3:22)> -> _cache_35933712 try: _cache_35933712 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 3, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (3:22)> value=<Marker name='default' at 2244e50> at 2244d10> -> _condition _expression = _cache_35933712 # <Marker name='default' at 2244e50> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35933712 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36723816 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36723816 append(u'</div>') if (_backup_attrs_36722808 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36722808 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36725608 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b810> name=None at 222b050> -> _value _value = _static_35829776 econtext['attrs'] = _value # <div ... (4:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36723960 = get('default', _marker) # <Marker name='default' at 2244e90> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (4:22)> -> _cache_35932816 try: _cache_35932816 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 4, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (4:22)> value=<Marker name='default' at 2244650> at 2244850> -> _condition _expression = _cache_35932816 # <Marker name='default' at 2244650> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35932816 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36723960 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36723960 append(u'</div>') if (_backup_attrs_36725608 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36725608 _content_139955154988272 = u'1\n 2' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36728632 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b610> name=None at 222b6d0> -> _value _value = _static_35829264 econtext['attrs'] = _value # <div ... (5:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36726760 = get('default', _marker) # <Marker name='default' at 222b510> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (5:22)> -> _cache_35828624 try: _cache_35828624 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 5, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (5:22)> value=<Marker name='default' at 222b0d0> at 222b190> -> _condition _expression = _cache_35828624 # <Marker name='default' at 222b0d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35828624 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36726760 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36726760 append(u'</div>') if (_backup_attrs_36728632 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36728632 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35918048 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b990> name=None at 222b110> -> _value _value = _static_35830160 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35918624 = get('default', _marker) # <Marker name='default' at 222bfd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (6:22)> -> _cache_35828432 try: _cache_35828432 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 6, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (6:22)> value=<Marker name='default' at 222b090> at 222bad0> -> _condition _expression = _cache_35828432 # <Marker name='default' at 222b090> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35828432 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35918624 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35918624 append(u'</div>') if (_backup_attrs_35918048 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35918048 _content_139955154988272 = u'3\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36622920 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222bd10> name=None at 222b750> -> _value _value = _static_35831056 econtext['attrs'] = _value # <div ... (7:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35917904 = get('default', _marker) # <Marker name='default' at 222b890> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (7:22)> -> _cache_35830544 try: _cache_35830544 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 7, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (7:22)> value=<Marker name='default' at 222b910> at 222ba10> -> _condition _expression = _cache_35830544 # <Marker name='default' at 222b910> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'4' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_35830544 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35917904 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35917904 append(u'</div>') if (_backup_attrs_36622920 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36622920 _content_139955154988272 = u'5\n 6' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36625656 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224590> name=None at 22243d0> -> _value _value = _static_35800464 econtext['attrs'] = _value # <div ... (8:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36625512 = get('default', _marker) # <Marker name='default' at 22242d0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (8:22)> -> _cache_35799696 try: _cache_35799696 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 8, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (8:22)> value=<Marker name='default' at 2224150> at 2224fd0> -> _condition _expression = _cache_35799696 # <Marker name='default' at 2224150> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35799696 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36625512 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36625512 append(u'</div>') if (_backup_attrs_36625656 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36625656 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36629968 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8550> name=None at 22f82d0> -> _value _value = _static_36668752 econtext['attrs'] = _value # <div ... (9:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36638016 = get('default', _marker) # <Marker name='default' at 2224dd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'1' (9:22)> -> _cache_35801168 try: _cache_35801168 = 1 except: rcontext.setdefault('__error__', []).append((u'1', 9, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'1' (9:22)> value=<Marker name='default' at 22249d0> at 2224990> -> _condition _expression = _cache_35801168 # <Marker name='default' at 22249d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35801168 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36638016 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36638016 append(u'</div>') if (_backup_attrs_36629968 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36629968 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36645704 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8790> name=None at 22f8750> -> _value _value = _static_36669328 econtext['attrs'] = _value # <div ... (10:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36644696 = get('default', _marker) # <Marker name='default' at 22f8350> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'1.0' (10:22)> -> _cache_36667600 try: _cache_36667600 = 1.0 except: rcontext.setdefault('__error__', []).append((u'1.0', 10, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'1.0' (10:22)> value=<Marker name='default' at 22f8150> at 22f8490> -> _condition _expression = _cache_36667600 # <Marker name='default' at 22f8150> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_36667600 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36644696 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36644696 append(u'</div>') if (_backup_attrs_36645704 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36645704 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35900664 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8950> name=None at 22f8890> -> _value _value = _static_36669776 econtext['attrs'] = _value # <div ... (11:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35898288 = get('default', _marker) # <Marker name='default' at 22f8bd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'True' (11:22)> -> _cache_36671120 try: _cache_36671120 = True except: rcontext.setdefault('__error__', []).append((u'True', 11, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'True' (11:22)> value=<Marker name='default' at 22f8f10> at 22f8f50> -> _condition _expression = _cache_36671120 # <Marker name='default' at 22f8f10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_36671120 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35898288 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35898288 append(u'</div>') if (_backup_attrs_35900664 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35900664 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36634424 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2238810> name=None at 2238290> -> _value _value = _static_35883024 econtext['attrs'] = _value # <div ... (12:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35900232 = get('default', _marker) # <Marker name='default' at 22f84d0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'False' (12:22)> -> _cache_36668816 try: _cache_36668816 = False except: rcontext.setdefault('__error__', []).append((u'False', 12, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'False' (12:22)> value=<Marker name='default' at 22f8c90> at 22f8c50> -> _condition _expression = _cache_36668816 # <Marker name='default' at 22f8c90> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_36668816 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35900232 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35900232 append(u'</div>') if (_backup_attrs_36634424 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36634424 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35898792 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x221f890> name=None at 221ff90> -> _value _value = _static_35780752 econtext['attrs'] = _value # <div ... (13:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36721512 = get('default', _marker) # <Marker name='default' at 221fcd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'0' (13:22)> -> _cache_35708496 try: _cache_35708496 = 0 except: rcontext.setdefault('__error__', []).append((u'0', 13, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'0' (13:22)> value=<Marker name='default' at 220ddd0> at 220dd50> -> _condition _expression = _cache_35708496 # <Marker name='default' at 220ddd0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35708496 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36721512 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36721512 append(u'</div>') if (_backup_attrs_35898792 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35898792 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35898504 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x223a090> name=None at 223a050> -> _value _value = _static_35889296 econtext['attrs'] = _value # <div ... (14:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35897784 = get('default', _marker) # <Marker name='default' at 221f610> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'None' (14:22)> -> _cache_35781136 try: _cache_35781136 = None except: rcontext.setdefault('__error__', []).append((u'None', 14, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'None' (14:22)> value=<Marker name='default' at 221ff10> at 221f490> -> _condition _expression = _cache_35781136 # <Marker name='default' at 221ff10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35781136 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35897784 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35897784 append(u'</div>') if (_backup_attrs_35898504 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35898504 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35899440 = get('default', _marker) # <Marker name='default' at 223a590> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'content' (15:22)> -> _cache_35890192 try: _cache_35890192 = getitem('content') except: rcontext.setdefault('__error__', []).append((u'content', 15, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'content' (15:22)> value=<Marker name='default' at 223a490> at 223a4d0> -> _condition _expression = _cache_35890192 # <Marker name='default' at 223a490> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_35901024 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x223a2d0> name=None at 223a290> -> _value _value = _static_35889872 econtext['attrs'] = _value # <div ... (15:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_35901024 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35901024 else: _content = _cache_35890192 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35899440 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35899440 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36718280 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36718280 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_36729128 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36729128 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/003.xml���������������������������������������������������0000644�0001750�0000144�00000000075�11445675021�022226� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc></doc > �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/004-attributes.pt�����������������������������������������0000644�0001750�0000144�00000002350�12035273027�024230� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <span tal:attributes="class 'hello'" /> <span class="goodbye" tal:attributes="class 'hello'" /> <span CLASS="goodbye" tal:attributes="class 'hello'" /> <span tal:attributes="class None" /> <span a="1" b="2" c="3" tal:attributes="a None" /> <span a="1" b="2" c="3" tal:attributes="b None" /> <span a="1" b="2" c="3" tal:attributes="c None" /> <span a="1" b="2" c="3" tal:attributes="b None; c None" /> <span a="1" b="2" c="3" tal:attributes="b string:;;" /> <span a="1" b="2" c="3" tal:attributes="b string:&" /> <span class="hello" tal:attributes="class 'goodbye'" /> <span class="hello" tal:attributes="class '"goodbye"'" /> <span class="hello" tal:attributes="class '\'goodbye\''" /> <span class='hello' tal:attributes="class '\'goodbye\''" /> <span tal:attributes="{'class': 'goodbye'}" /> <span class="hello" tal:attributes="{'class': 'goodbye'}" /> <span a="1" class="hello" tal:attributes="{'class': 'goodbye'}" /> <span tal:attributes="{'class': '"goodbye"'}" /> <span tal:attributes="class 'hello'; {'class': '"goodbye"'}" /> <span tal:attributes="{'class': '"goodbye"'}; class 'hello'" /> </body> </html> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/004-attributes.pt.py��������������������������������������0000600�0001750�0000144�00000072306�11547550676�024676� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_36671184 = {u'a': u'1', u'c': u'3', u'b': u'2', } _static_35828944 = {} _static_35829584 = {u'class': u'None', } _static_35889552 = {u'a': u'1', u'c': u'3', u'b': u'2', } _static_35801168 = {u'a': u'1', u'c': u'3', u'b': u'2', } _static_35707920 = {u'a': u'1', u'c': u'3', u'b': u'2', } _static_35800848 = {u'a': u'1', u'c': u'3', u'b': u'2', } _static_35830736 = {u'class': u"'hello'", } _static_35890768 = {u'class': u'hello', } _static_36668176 = {u'a': u'1', u'c': u'3', u'b': u'2', } _static_35828624 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39099424 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b4d0> name=None at 222b850> -> _value _value = _static_35828944 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36624936 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b390> name=None at 222b250> -> _value _value = _static_35828624 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36627376 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222bbd0> name=None at 222b990> -> _value _value = _static_35830736 econtext['attrs'] = _value # <span ... (3:4) # -------------------------------------------------------- append(u'<span') _backup_default_36629176 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u"'hello'" (3:32)> -> _attr_class try: _attr_class = 'hello' except: rcontext.setdefault('__error__', []).append((u"'hello'", 3, 32, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if ('"' in _attr_class): _attr_class = _attr_class.replace('"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_36629176 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36629176 append(u' />') if (_backup_attrs_36627376 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36627376 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36724032 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b750> name=None at 222bf90> -> _value _value = _static_35829584 econtext['attrs'] = _value # <span ... (4:4) # -------------------------------------------------------- append(u'<span') _backup_default_36724464 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u'None' (4:32)> -> _attr_class try: _attr_class = None except: rcontext.setdefault('__error__', []).append((u'None', 4, 32, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if ('"' in _attr_class): _attr_class = _attr_class.replace('"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_36724464 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36724464 append(u' />') if (_backup_attrs_36724032 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36724032 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36721872 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224710> name=None at 2224090> -> _value _value = _static_35800848 econtext['attrs'] = _value # <span ... (5:4) # -------------------------------------------------------- append(u'<span') _backup_default_36721584 = get('default', _marker) _value = u'1' econtext['default'] = _value # <Expression u'None' (5:46)> -> _attr_a try: _attr_a = None except: rcontext.setdefault('__error__', []).append((u'None', 5, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_a is None): pass else: if (_attr_a is False): _attr_a = None else: _tt = type(_attr_a) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_a = unicode(_attr_a) else: try: if (_tt is str): _attr_a = decode(_attr_a) else: if (_tt is not unicode): try: _attr_a = _attr_a.__html__ except: _attr_a = convert(_attr_a) else: raise RuntimeError except RuntimeError: _attr_a = _attr_a() else: if ((_attr_a is not None) and (re_needs_escape(_attr_a) is not None)): if ('&' in _attr_a): if (';' in _attr_a): _attr_a = re_amp.sub('&', _attr_a) else: _attr_a = _attr_a.replace('&', '&') if ('<' in _attr_a): _attr_a = _attr_a.replace('<', '<') if ('>' in _attr_a): _attr_a = _attr_a.replace('>', '>') if (u'"' in _attr_a): _attr_a = _attr_a.replace(u'"', '"') if (_attr_a is not None): append((u' a="%s"' % _attr_a)) if (_backup_default_36721584 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36721584 _attr_b = u'2' if (_attr_b is not None): append((u' b="%s"' % _attr_b)) _attr_c = u'3' if (_attr_c is not None): append((u' c="%s"' % _attr_c)) append(u' />') if (_backup_attrs_36721872 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36721872 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36722376 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224850> name=None at 2224050> -> _value _value = _static_35801168 econtext['attrs'] = _value # <span ... (6:4) # -------------------------------------------------------- append(u'<span') _attr_a = u'1' if (_attr_a is not None): append((u' a="%s"' % _attr_a)) _backup_default_36722520 = get('default', _marker) _value = u'2' econtext['default'] = _value # <Expression u'None' (6:46)> -> _attr_b try: _attr_b = None except: rcontext.setdefault('__error__', []).append((u'None', 6, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_b is None): pass else: if (_attr_b is False): _attr_b = None else: _tt = type(_attr_b) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_b = unicode(_attr_b) else: try: if (_tt is str): _attr_b = decode(_attr_b) else: if (_tt is not unicode): try: _attr_b = _attr_b.__html__ except: _attr_b = convert(_attr_b) else: raise RuntimeError except RuntimeError: _attr_b = _attr_b() else: if ((_attr_b is not None) and (re_needs_escape(_attr_b) is not None)): if ('&' in _attr_b): if (';' in _attr_b): _attr_b = re_amp.sub('&', _attr_b) else: _attr_b = _attr_b.replace('&', '&') if ('<' in _attr_b): _attr_b = _attr_b.replace('<', '<') if ('>' in _attr_b): _attr_b = _attr_b.replace('>', '>') if (u'"' in _attr_b): _attr_b = _attr_b.replace(u'"', '"') if (_attr_b is not None): append((u' b="%s"' % _attr_b)) if (_backup_default_36722520 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36722520 _attr_c = u'3' if (_attr_c is not None): append((u' c="%s"' % _attr_c)) append(u' />') if (_backup_attrs_36722376 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36722376 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36723312 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8310> name=None at 22f8650> -> _value _value = _static_36668176 econtext['attrs'] = _value # <span ... (7:4) # -------------------------------------------------------- append(u'<span') _attr_a = u'1' if (_attr_a is not None): append((u' a="%s"' % _attr_a)) _attr_b = u'2' if (_attr_b is not None): append((u' b="%s"' % _attr_b)) _backup_default_36723240 = get('default', _marker) _value = u'3' econtext['default'] = _value # <Expression u'None' (7:46)> -> _attr_c try: _attr_c = None except: rcontext.setdefault('__error__', []).append((u'None', 7, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_c is None): pass else: if (_attr_c is False): _attr_c = None else: _tt = type(_attr_c) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_c = unicode(_attr_c) else: try: if (_tt is str): _attr_c = decode(_attr_c) else: if (_tt is not unicode): try: _attr_c = _attr_c.__html__ except: _attr_c = convert(_attr_c) else: raise RuntimeError except RuntimeError: _attr_c = _attr_c() else: if ((_attr_c is not None) and (re_needs_escape(_attr_c) is not None)): if ('&' in _attr_c): if (';' in _attr_c): _attr_c = re_amp.sub('&', _attr_c) else: _attr_c = _attr_c.replace('&', '&') if ('<' in _attr_c): _attr_c = _attr_c.replace('<', '<') if ('>' in _attr_c): _attr_c = _attr_c.replace('>', '>') if (u'"' in _attr_c): _attr_c = _attr_c.replace(u'"', '"') if (_attr_c is not None): append((u' c="%s"' % _attr_c)) if (_backup_default_36723240 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36723240 append(u' />') if (_backup_attrs_36723312 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36723312 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36724248 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8ed0> name=None at 22f8f90> -> _value _value = _static_36671184 econtext['attrs'] = _value # <span ... (8:4) # -------------------------------------------------------- append(u'<span') _attr_a = u'1' if (_attr_a is not None): append((u' a="%s"' % _attr_a)) _backup_default_36723384 = get('default', _marker) _value = u'2' econtext['default'] = _value # <Expression u'None' (8:46)> -> _attr_b try: _attr_b = None except: rcontext.setdefault('__error__', []).append((u'None', 8, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_b is None): pass else: if (_attr_b is False): _attr_b = None else: _tt = type(_attr_b) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_b = unicode(_attr_b) else: try: if (_tt is str): _attr_b = decode(_attr_b) else: if (_tt is not unicode): try: _attr_b = _attr_b.__html__ except: _attr_b = convert(_attr_b) else: raise RuntimeError except RuntimeError: _attr_b = _attr_b() else: if ((_attr_b is not None) and (re_needs_escape(_attr_b) is not None)): if ('&' in _attr_b): if (';' in _attr_b): _attr_b = re_amp.sub('&', _attr_b) else: _attr_b = _attr_b.replace('&', '&') if ('<' in _attr_b): _attr_b = _attr_b.replace('<', '<') if ('>' in _attr_b): _attr_b = _attr_b.replace('>', '>') if (u'"' in _attr_b): _attr_b = _attr_b.replace(u'"', '"') if (_attr_b is not None): append((u' b="%s"' % _attr_b)) if (_backup_default_36723384 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36723384 _backup_default_36724680 = get('default', _marker) _value = u'3' econtext['default'] = _value # <Expression u'None' (8:53)> -> _attr_c try: _attr_c = None except: rcontext.setdefault('__error__', []).append((u'None', 8, 53, '<string>', _sys.exc_info()[1], )) raise if (_attr_c is None): pass else: if (_attr_c is False): _attr_c = None else: _tt = type(_attr_c) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_c = unicode(_attr_c) else: try: if (_tt is str): _attr_c = decode(_attr_c) else: if (_tt is not unicode): try: _attr_c = _attr_c.__html__ except: _attr_c = convert(_attr_c) else: raise RuntimeError except RuntimeError: _attr_c = _attr_c() else: if ((_attr_c is not None) and (re_needs_escape(_attr_c) is not None)): if ('&' in _attr_c): if (';' in _attr_c): _attr_c = re_amp.sub('&', _attr_c) else: _attr_c = _attr_c.replace('&', '&') if ('<' in _attr_c): _attr_c = _attr_c.replace('<', '<') if ('>' in _attr_c): _attr_c = _attr_c.replace('>', '>') if (u'"' in _attr_c): _attr_c = _attr_c.replace(u'"', '"') if (_attr_c is not None): append((u' c="%s"' % _attr_c)) if (_backup_default_36724680 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36724680 append(u' />') if (_backup_attrs_36724248 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36724248 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38641744 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x220dc10> name=None at 220ddd0> -> _value _value = _static_35707920 econtext['attrs'] = _value # <span ... (9:4) # -------------------------------------------------------- append(u'<span') _attr_a = u'1' if (_attr_a is not None): append((u' a="%s"' % _attr_a)) _backup_default_38642032 = get('default', _marker) _value = u'2' econtext['default'] = _value # <Expression u'string:;' (9:46)> -> _attr_b try: _attr_b = u';' except: rcontext.setdefault('__error__', []).append((u'string:;', 9, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_b is None): pass else: if (_attr_b is False): _attr_b = None else: _tt = type(_attr_b) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_b = unicode(_attr_b) else: try: if (_tt is str): _attr_b = decode(_attr_b) else: if (_tt is not unicode): try: _attr_b = _attr_b.__html__ except: _attr_b = convert(_attr_b) else: raise RuntimeError except RuntimeError: _attr_b = _attr_b() else: if ((_attr_b is not None) and (re_needs_escape(_attr_b) is not None)): if ('&' in _attr_b): if (';' in _attr_b): _attr_b = re_amp.sub('&', _attr_b) else: _attr_b = _attr_b.replace('&', '&') if ('<' in _attr_b): _attr_b = _attr_b.replace('<', '<') if ('>' in _attr_b): _attr_b = _attr_b.replace('>', '>') if (u'"' in _attr_b): _attr_b = _attr_b.replace(u'"', '"') if (_attr_b is not None): append((u' b="%s"' % _attr_b)) if (_backup_default_38642032 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38642032 _attr_c = u'3' if (_attr_c is not None): append((u' c="%s"' % _attr_c)) append(u' />') if (_backup_attrs_38641744 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38641744 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36721224 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x223a190> name=None at 223a1d0> -> _value _value = _static_35889552 econtext['attrs'] = _value # <span ... (10:4) # -------------------------------------------------------- append(u'<span') _attr_a = u'1' if (_attr_a is not None): append((u' a="%s"' % _attr_a)) _backup_default_36721080 = get('default', _marker) _value = u'2' econtext['default'] = _value # <Expression u'string:&' (10:46)> -> _attr_b try: _attr_b = u'&' except: rcontext.setdefault('__error__', []).append((u'string:&', 10, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_b is None): pass else: if (_attr_b is False): _attr_b = None else: _tt = type(_attr_b) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_b = unicode(_attr_b) else: try: if (_tt is str): _attr_b = decode(_attr_b) else: if (_tt is not unicode): try: _attr_b = _attr_b.__html__ except: _attr_b = convert(_attr_b) else: raise RuntimeError except RuntimeError: _attr_b = _attr_b() else: if ((_attr_b is not None) and (re_needs_escape(_attr_b) is not None)): if ('&' in _attr_b): if (';' in _attr_b): _attr_b = re_amp.sub('&', _attr_b) else: _attr_b = _attr_b.replace('&', '&') if ('<' in _attr_b): _attr_b = _attr_b.replace('<', '<') if ('>' in _attr_b): _attr_b = _attr_b.replace('>', '>') if (u'"' in _attr_b): _attr_b = _attr_b.replace(u'"', '"') if (_attr_b is not None): append((u' b="%s"' % _attr_b)) if (_backup_default_36721080 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36721080 _attr_c = u'3' if (_attr_c is not None): append((u' c="%s"' % _attr_c)) append(u' />') if (_backup_attrs_36721224 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36721224 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38642176 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x223a650> name=None at 223a250> -> _value _value = _static_35890768 econtext['attrs'] = _value # <span ... (11:4) # -------------------------------------------------------- append(u'<span') _backup_default_38642104 = get('default', _marker) _value = u'hello' econtext['default'] = _value # <Expression u"'goodbye'" (11:46)> -> _attr_class try: _attr_class = 'goodbye' except: rcontext.setdefault('__error__', []).append((u"'goodbye'", 11, 46, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_38642104 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38642104 append(u' />') if (_backup_attrs_38642176 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38642176 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36624936 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36624936 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_39099424 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39099424 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/004.xml���������������������������������������������������0000644�0001750�0000144�00000000146�11445675021�022226� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA #IMPLIED> ]> <doc a1="v1"></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/005-default.pt��������������������������������������������0000644�0001750�0000144�00000000542�11631410432�023462� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <img class="default" tal:attributes="class default" /> <img tal:attributes="class default" /> <span tal:content="default">Default</span> <span tal:content="True">Default</span> <span tal:content="False">Default</span> <span tal:content="default"> <em>${'Computed default'}</em> </span> </body> </html> ��������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/005-default.pt.py�����������������������������������������0000600�0001750�0000144�00000043237�11547550676�024136� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_35707984 = {} _static_35803088 = {} _static_36671184 = {} _static_35779600 = {} _static_36670416 = {u'class': u'default', } _static_36668432 = {u'class': u'default', } _static_35802384 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38643400 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224d10> name=None at 2224a10> -> _value _value = _static_35802384 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38494936 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224fd0> name=None at 2224290> -> _value _value = _static_35803088 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38642320 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8410> name=None at 2224dd0> -> _value _value = _static_36668432 econtext['attrs'] = _value # <img ... (3:4) # -------------------------------------------------------- append(u'<img') _backup_default_38494504 = get('default', _marker) _value = u'default' econtext['default'] = _value # <Expression u'default' (3:47)> -> _attr_class try: _attr_class = getitem('default') except: rcontext.setdefault('__error__', []).append((u'default', 3, 47, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_38494504 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38494504 append(u' />') if (_backup_attrs_38642320 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38642320 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38495800 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8bd0> name=None at 22f8810> -> _value _value = _static_36670416 econtext['attrs'] = _value # <img ... (4:4) # -------------------------------------------------------- append(u'<img') _backup_default_38495728 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u'default' (4:31)> -> _attr_class try: _attr_class = getitem('default') except: rcontext.setdefault('__error__', []).append((u'default', 4, 31, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if ('"' in _attr_class): _attr_class = _attr_class.replace('"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_38495728 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38495728 append(u' />') if (_backup_attrs_38495800 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38495800 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38571832 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8ed0> name=None at 22f8f90> -> _value _value = _static_36671184 econtext['attrs'] = _value # <span ... (5:4) # -------------------------------------------------------- append(u'<span>') _backup_default_37019016 = get('default', _marker) # <Marker name='default' at 22f8890> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'default' (5:23)> -> _cache_36670032 try: _cache_36670032 = getitem('default') except: rcontext.setdefault('__error__', []).append((u'default', 5, 23, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'default' (5:23)> value=<Marker name='default' at 22f8990> at 22f89d0> -> _condition _expression = _cache_36670032 # <Marker name='default' at 22f8990> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'Default' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_36670032 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_37019016 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_37019016 append(u'</span>') if (_backup_attrs_38571832 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38571832 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38604240 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x220dc50> name=None at 22f8e90> -> _value _value = _static_35707984 econtext['attrs'] = _value # <span ... (6:4) # -------------------------------------------------------- append(u'<span>') _backup_default_38601360 = get('default', _marker) # <Marker name='default' at 22f8b50> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'default' (6:23)> -> _cache_36670672 try: _cache_36670672 = getitem('default') except: rcontext.setdefault('__error__', []).append((u'default', 6, 23, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'default' (6:23)> value=<Marker name='default' at 22f88d0> at 22f8590> -> _condition _expression = _cache_36670672 # <Marker name='default' at 22f88d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38632624 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x221f410> name=None at 221f490> -> _value _value = _static_35779600 econtext['attrs'] = _value # <em ... (7:6) # -------------------------------------------------------- append(u'<em>') # <Expression u"'Computed default'" (7:12)> -> _content_139955154988272 try: _content_139955154988272 = 'Computed default' except: rcontext.setdefault('__error__', []).append((u"'Computed default'", 7, 12, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</em>') if (_backup_attrs_38632624 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38632624 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_36670672 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38601360 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38601360 append(u'</span>') if (_backup_attrs_38604240 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38604240 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38494936 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38494936 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38643400 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38643400 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/005.xml���������������������������������������������������0000644�0001750�0000144�00000000150�11445675021�022222� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA #IMPLIED> ]> <doc a1 = "v1"></doc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/006-attribute-interpolation.pt����������������������������0000644�0001750�0000144�00000000617�11637044266�026750� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body class="ltr" tal:define="hash string:#"> <img src="${'#'}" alt="copyright (c) ${2010}" /> <img src="" alt="copyright (c) ${2010}" tal:attributes="src string:$hash" /> <img src="" alt="copyright (c) ${2010}" tal:attributes="src string:${hash}" /> <img src="${None}" alt="$ignored" /> <img src="" alt="${'%stype \'str\'%s' % (chr(60), chr(62))}" /> </body> </html> �����������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/006-attribute-interpolation.pt.py�������������������������0000600�0001750�0000144�00000024156�11547550676�027402� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_36670736 = {u'src': u"${'#'}", u'alt': u'copyright (c) ${2010}', } _static_36669072 = {u'class': u'ltr', } _static_36669648 = {u'src': u'${None}', } _static_36667984 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_36723672 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8250> name=None at 22f8550> -> _value _value = _static_36667984 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36648360 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8690> name=None at 22f80d0> -> _value _value = _static_36669072 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body') _attr_class = u'ltr' if (_attr_class is not None): append((u' class="%s"' % _attr_class)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36648216 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8d10> name=None at 22f8d90> -> _value _value = _static_36670736 econtext['attrs'] = _value # <img ... (3:4) # -------------------------------------------------------- append(u'<img') _backup_default_36648432 = get('default', _marker) _value = u"${'#'}" econtext['default'] = _value # <Interpolation value=u"${'#'}" escape=True at 22f8a50> -> _attr_src # <Expression u"'#'" (3:16)> -> _attr_src try: _attr_src = '#' except: rcontext.setdefault('__error__', []).append((u"'#'", 3, 16, '<string>', _sys.exc_info()[1], )) raise _attr_src = _attr_src if (_attr_src is None): pass else: if (_attr_src is False): _attr_src = None else: _tt = type(_attr_src) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_src = unicode(_attr_src) else: try: if (_tt is str): _attr_src = decode(_attr_src) else: if (_tt is not unicode): try: _attr_src = _attr_src.__html__ except: _attr_src = convert(_attr_src) else: raise RuntimeError except RuntimeError: _attr_src = _attr_src() else: if ((_attr_src is not None) and (re_needs_escape(_attr_src) is not None)): if ('&' in _attr_src): if (';' in _attr_src): _attr_src = re_amp.sub('&', _attr_src) else: _attr_src = _attr_src.replace('&', '&') if ('<' in _attr_src): _attr_src = _attr_src.replace('<', '<') if ('>' in _attr_src): _attr_src = _attr_src.replace('>', '>') if (u'"' in _attr_src): _attr_src = _attr_src.replace(u'"', '"') if (_attr_src is not None): append((u' src="%s"' % _attr_src)) if (_backup_default_36648432 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36648432 _backup_default_39035896 = get('default', _marker) _value = u'copyright (c) ${2010}' econtext['default'] = _value # <Interpolation value=u'copyright (c) ${2010}' escape=True at 22f8090> -> _attr_alt # <Expression u'2010' (3:43)> -> _attr_alt try: _attr_alt = 2010 except: rcontext.setdefault('__error__', []).append((u'2010', 3, 43, '<string>', _sys.exc_info()[1], )) raise _attr_alt = ('%s%s' % ((u'copyright (c) ' if (u'copyright (c) ' is not None) else ''), (_attr_alt if (_attr_alt is not None) else ''), )) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if (u'"' in _attr_alt): _attr_alt = _attr_alt.replace(u'"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_39035896 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39035896 append(u' />') if (_backup_attrs_36648216 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36648216 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36650448 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f88d0> name=None at 22f8590> -> _value _value = _static_36669648 econtext['attrs'] = _value # <img ... (4:4) # -------------------------------------------------------- append(u'<img') _backup_default_36650232 = get('default', _marker) _value = u'${None}' econtext['default'] = _value # <Interpolation value=u'${None}' escape=True at 221fb90> -> _attr_src # <Expression u'None' (4:16)> -> _attr_src try: _attr_src = None except: rcontext.setdefault('__error__', []).append((u'None', 4, 16, '<string>', _sys.exc_info()[1], )) raise _attr_src = _attr_src if (_attr_src is None): pass else: if (_attr_src is False): _attr_src = None else: _tt = type(_attr_src) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_src = unicode(_attr_src) else: try: if (_tt is str): _attr_src = decode(_attr_src) else: if (_tt is not unicode): try: _attr_src = _attr_src.__html__ except: _attr_src = convert(_attr_src) else: raise RuntimeError except RuntimeError: _attr_src = _attr_src() else: if ((_attr_src is not None) and (re_needs_escape(_attr_src) is not None)): if ('&' in _attr_src): if (';' in _attr_src): _attr_src = re_amp.sub('&', _attr_src) else: _attr_src = _attr_src.replace('&', '&') if ('<' in _attr_src): _attr_src = _attr_src.replace('<', '<') if ('>' in _attr_src): _attr_src = _attr_src.replace('>', '>') if (u'"' in _attr_src): _attr_src = _attr_src.replace(u'"', '"') if (_attr_src is not None): append((u' src="%s"' % _attr_src)) if (_backup_default_36650232 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36650232 append(u' />') if (_backup_attrs_36650448 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36650448 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36648360 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36648360 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_36723672 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36723672 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/006.xml���������������������������������������������������0000644�0001750�0000144�00000000146�11445675021�022230� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA #IMPLIED> ]> <doc a1='v1'></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/007-content-interpolation.pt������������������������������0000644�0001750�0000144�00000000500�12034551641�026377� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> ${'Hello world!'} ${literal} ${structure: literal.s} ${"%stype 'str'%s" % (chr(60), chr(62))} && ${None} ${None or 'Hello world'} $leftalone <div>${None}</div> <div>${1 < 2 and 'Hello world' or None}</div> <div>${} is ignored.</div> </body> </html> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/007-content-interpolation.pt.py���������������������������0000600�0001750�0000144�00000030707�11547550676�027051� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_36670096 = {} _static_35829392 = {} _static_35708624 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_37246736 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x220ded0> name=None at 221fb90> -> _value _value = _static_35708624 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38435512 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b690> name=None at 222bb50> -> _value _value = _static_35829392 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') # <Expression u"'Hello world!'" (3:6)> -> _content_139955154988272 try: _content_139955154988272 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 3, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') # <Expression u'literal' (4:6)> -> _content_139955154988272_42 try: _content_139955154988272_42 = getitem('literal') except: rcontext.setdefault('__error__', []).append((u'literal', 4, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_42 is None): pass else: if (_content_139955154988272_42 is False): _content_139955154988272_42 = None else: _tt = type(_content_139955154988272_42) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_42 = unicode(_content_139955154988272_42) else: try: if (_tt is str): _content_139955154988272_42 = decode(_content_139955154988272_42) else: if (_tt is not unicode): try: _content_139955154988272_42 = _content_139955154988272_42.__html__ except: _content_139955154988272_42 = convert(_content_139955154988272_42) else: raise RuntimeError except RuntimeError: _content_139955154988272_42 = _content_139955154988272_42() else: if ((_content_139955154988272_42 is not None) and (re_needs_escape(_content_139955154988272_42) is not None)): if ('&' in _content_139955154988272_42): if (';' in _content_139955154988272_42): _content_139955154988272_42 = re_amp.sub('&', _content_139955154988272_42) else: _content_139955154988272_42 = _content_139955154988272_42.replace('&', '&') if ('<' in _content_139955154988272_42): _content_139955154988272_42 = _content_139955154988272_42.replace('<', '<') if ('>' in _content_139955154988272_42): _content_139955154988272_42 = _content_139955154988272_42.replace('>', '>') if ('\x00' in _content_139955154988272_42): _content_139955154988272_42 = _content_139955154988272_42.replace('\x00', '"') # <Expression u'None' (5:6)> -> _content_139955154988272_57 try: _content_139955154988272_57 = None except: rcontext.setdefault('__error__', []).append((u'None', 5, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_57 is None): pass else: if (_content_139955154988272_57 is False): _content_139955154988272_57 = None else: _tt = type(_content_139955154988272_57) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_57 = unicode(_content_139955154988272_57) else: try: if (_tt is str): _content_139955154988272_57 = decode(_content_139955154988272_57) else: if (_tt is not unicode): try: _content_139955154988272_57 = _content_139955154988272_57.__html__ except: _content_139955154988272_57 = convert(_content_139955154988272_57) else: raise RuntimeError except RuntimeError: _content_139955154988272_57 = _content_139955154988272_57() else: if ((_content_139955154988272_57 is not None) and (re_needs_escape(_content_139955154988272_57) is not None)): if ('&' in _content_139955154988272_57): if (';' in _content_139955154988272_57): _content_139955154988272_57 = re_amp.sub('&', _content_139955154988272_57) else: _content_139955154988272_57 = _content_139955154988272_57.replace('&', '&') if ('<' in _content_139955154988272_57): _content_139955154988272_57 = _content_139955154988272_57.replace('<', '<') if ('>' in _content_139955154988272_57): _content_139955154988272_57 = _content_139955154988272_57.replace('>', '>') if ('\x00' in _content_139955154988272_57): _content_139955154988272_57 = _content_139955154988272_57.replace('\x00', '"') _content_139955154988272 = ('%s%s%s%s%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272_42 if (_content_139955154988272_42 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272_57 if (_content_139955154988272_57 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38446936 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8a90> name=None at 22f8810> -> _value _value = _static_36670096 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') # <Expression u'None' (6:11)> -> _content_139955154988272 try: _content_139955154988272 = None except: rcontext.setdefault('__error__', []).append((u'None', 6, 11, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_38446936 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38446936 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38435512 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38435512 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_37246736 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37246736 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/007.xml���������������������������������������������������0000644�0001750�0000144�00000000101�11445675021�022220� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc> </doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/008-builtins.pt�������������������������������������������0000644�0001750�0000144�00000000352�12034532566�023704� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> ${attrs} ${nothing} <div tal:attributes="class string:dynamic" class="static"> ${attrs['class']} </div> <div tal:define="nothing string:nothing"> ${nothing} </div> </body> </html> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/008-builtins.pt.py����������������������������������������0000600�0001750�0000144�00000023577�11547550676�024353� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_35829392 = {} _static_36669456 = {} _static_36669712 = {u'class': u'static', } import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35754928 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b690> name=None at 222bb50> -> _value _value = _static_35829392 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35872992 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8810> name=None at 22f8210> -> _value _value = _static_36669456 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') # <Expression u'nothing' (3:6)> -> _content_139955154988272 try: _content_139955154988272 = getitem('nothing') except: rcontext.setdefault('__error__', []).append((u'nothing', 3, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35755576 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8910> name=None at 22f8f10> -> _value _value = _static_36669712 econtext['attrs'] = _value # <div ... (4:4) # -------------------------------------------------------- append(u'<div') _backup_default_35755720 = get('default', _marker) _value = u'static' econtext['default'] = _value # <Expression u'string:dynamic' (4:31)> -> _attr_class try: _attr_class = u'dynamic' except: rcontext.setdefault('__error__', []).append((u'string:dynamic', 4, 31, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_35755720 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35755720 append(u'>') # <Expression u"attrs['class']" (5:8)> -> _content_139955154988272 try: _content_139955154988272 = getitem('attrs')['class'] except: rcontext.setdefault('__error__', []).append((u"attrs['class']", 5, 8, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_35755576 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35755576 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35872992 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35872992 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35754928 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35754928 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/008.xml���������������������������������������������������0000644�0001750�0000144�00000000125�11445675021�022227� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc>&<>"'</doc> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/009-literals.pt�������������������������������������������0000644�0001750�0000144�00000000061�11445675021�023667� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> ${literal} </body> </html> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/009-literals.pt.py����������������������������������������0000600�0001750�0000144�00000010723�11547550676�024327� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_36667792 = {} _static_36669264 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_37031304 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8750> name=None at 22f8a90> -> _value _value = _static_36669264 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37004352 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8190> name=None at 22f8bd0> -> _value _value = _static_36667792 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') # <Expression u'literal' (3:6)> -> _content_139955154988272 try: _content_139955154988272 = getitem('literal') except: rcontext.setdefault('__error__', []).append((u'literal', 3, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_37004352 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37004352 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_37031304 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37031304 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/009.xml���������������������������������������������������0000644�0001750�0000144�00000000102�11445675021�022223� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc> </doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/010-structure.pt������������������������������������������0000644�0001750�0000144�00000000475�11614001220�024067� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:content="text string:1 < 2" /> <div tal:content="structure string:2 < 3, 2&3, 2<3, 2>3" /> <div tal:content="structure string:3 ${'<'} 4" /> <div tal:content="structure '%d < %d' % (4, 5)" /> <div tal:replace="structure content" /> </body> </html> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/010-structure.pt.py���������������������������������������0000600�0001750�0000144�00000034263�11547550676�024545� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_38579792 = {} _static_38552272 = {} _static_35801168 = {} _static_38555600 = {} _static_35799376 = {} _static_38553168 = {} _static_38553552 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39070032 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24c4650> name=None at 223a290> -> _value _value = _static_38553168 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39067944 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24c4fd0> name=None at 24c4f90> -> _value _value = _static_38555600 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39069312 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24c47d0> name=None at 24c4b90> -> _value _value = _static_38553552 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_39069744 = get('default', _marker) # <Marker name='default' at 24c4610> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:1 < 2' (3:27)> -> _cache_38555024 try: _cache_38555024 = u'1 < 2' except: rcontext.setdefault('__error__', []).append((u'string:1 < 2', 3, 27, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:1 < 2' (3:27)> value=<Marker name='default' at 24c4e10> at 24c4950> -> _condition _expression = _cache_38555024 # <Marker name='default' at 24c4e10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38555024 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39069744 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39069744 append(u'</div>') if (_backup_attrs_39069312 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39069312 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39070608 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24c42d0> name=None at 24c4290> -> _value _value = _static_38552272 econtext['attrs'] = _value # <div ... (4:4) # -------------------------------------------------------- append(u'<div>') _backup_default_39044592 = get('default', _marker) # <Marker name='default' at 24c49d0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:2 < 3' (4:32)> -> _cache_38552400 try: _cache_38552400 = u'2 < 3' except: rcontext.setdefault('__error__', []).append((u'string:2 < 3', 4, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:2 < 3' (4:32)> value=<Marker name='default' at 24c4890> at 24c4250> -> _condition _expression = _cache_38552400 # <Marker name='default' at 24c4890> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38552400 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_39044592 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39044592 append(u'</div>') if (_backup_attrs_39070608 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39070608 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37107256 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224850> name=None at 22241d0> -> _value _value = _static_35801168 econtext['attrs'] = _value # <div ... (5:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35897424 = get('default', _marker) # <Marker name='default' at 2224250> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"string:3 ${'<'} 4" (5:32)> -> _cache_38551888 try: _cache_38551888 = '<' _cache_38551888 = ('%s%s%s' % ((u'3 ' if (u'3 ' is not None) else ''), (_cache_38551888 if (_cache_38551888 is not None) else ''), (u' 4' if (u' 4' is not None) else ''), )) except: rcontext.setdefault('__error__', []).append((u"string:3 ${'<'} 4", 5, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"string:3 ${'<'} 4" (5:32)> value=<Marker name='default' at 24c4110> at 24c40d0> -> _condition _expression = _cache_38551888 # <Marker name='default' at 24c4110> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38551888 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_35897424 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35897424 append(u'</div>') if (_backup_attrs_37107256 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37107256 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39055304 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224150> name=None at 2224dd0> -> _value _value = _static_35799376 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _backup_default_39086560 = get('default', _marker) # <Marker name='default' at 2224a10> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'%d < %d' % (4, 5)" (6:32)> -> _cache_35801680 try: _cache_35801680 = ('%d < %d' % (4, 5, )) except: rcontext.setdefault('__error__', []).append((u"'%d < %d' % (4, 5)", 6, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'%d < %d' % (4, 5)" (6:32)> value=<Marker name='default' at 2224cd0> at 2224ed0> -> _condition _expression = _cache_35801680 # <Marker name='default' at 2224cd0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35801680 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_39086560 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39086560 append(u'</div>') if (_backup_attrs_39055304 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39055304 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39076928 = get('default', _marker) # <Marker name='default' at 24ca810> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'content' (7:32)> -> _cache_38578128 try: _cache_38578128 = getitem('content') except: rcontext.setdefault('__error__', []).append((u'content', 7, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'content' (7:32)> value=<Marker name='default' at 24cab50> at 24ca610> -> _condition _expression = _cache_38578128 # <Marker name='default' at 24cab50> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39051992 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cae50> name=None at 24cac10> -> _value _value = _static_38579792 econtext['attrs'] = _value # <div ... (7:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_39051992 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39051992 else: _content = _cache_38578128 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_39076928 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39076928 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_39067944 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39067944 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_39070032 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39070032 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/010.xml���������������������������������������������������0000644�0001750�0000144�00000000147�11445675021�022224� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA #IMPLIED> ]> <doc a1="v1" ></doc> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/011-messages.pt�������������������������������������������0000644�0001750�0000144�00000000353�11445675021�023654� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:content="text message" /> <div tal:content="structure message" /> <div tal:content="text string:${message}" /> <div tal:content="structure string:${message}" /> ${message} </body> </html> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/011-messages.pt-en.py�������������������������������������0000600�0001750�0000144�00000036702�11547550676�024715� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_38588816 = {} _static_35799696 = {} _static_38462608 = {} _static_38590736 = {} _static_38589968 = {} _static_35802320 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35342528 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cd910> name=None at 24cd410> -> _value _value = _static_38590736 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35343752 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cd610> name=None at 24cd8d0> -> _value _value = _static_38589968 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35343680 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cd190> name=None at 24cdfd0> -> _value _value = _static_38588816 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35343392 = get('default', _marker) # <Marker name='default' at 24cd710> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'message' (3:27)> -> _cache_38588624 try: _cache_38588624 = getitem('message') except: rcontext.setdefault('__error__', []).append((u'message', 3, 27, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'message' (3:27)> value=<Marker name='default' at 24cd590> at 24cd490> -> _condition _expression = _cache_38588624 # <Marker name='default' at 24cd590> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38588624 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35343392 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35343392 append(u'</div>') if (_backup_attrs_35343680 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35343680 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35343176 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae490> name=None at 24ae810> -> _value _value = _static_38462608 econtext['attrs'] = _value # <div ... (4:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35344112 = get('default', _marker) # <Marker name='default' at 24aebd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'message' (4:32)> -> _cache_38461520 try: _cache_38461520 = getitem('message') except: rcontext.setdefault('__error__', []).append((u'message', 4, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'message' (4:32)> value=<Marker name='default' at 24ae910> at 24ae210> -> _condition _expression = _cache_38461520 # <Marker name='default' at 24ae910> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38461520 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_35344112 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35344112 append(u'</div>') if (_backup_attrs_35343176 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35343176 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38452616 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224290> name=None at 2224050> -> _value _value = _static_35799696 econtext['attrs'] = _value # <div ... (5:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35340656 = get('default', _marker) # <Marker name='default' at 24ae110> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:${message}' (5:27)> -> _cache_38464720 try: _cache_38464720 = getitem('message') _cache_38464720 = _cache_38464720 except: rcontext.setdefault('__error__', []).append((u'string:${message}', 5, 27, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:${message}' (5:27)> value=<Marker name='default' at 24ae690> at 24ae990> -> _condition _expression = _cache_38464720 # <Marker name='default' at 24ae690> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38464720 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35340656 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35340656 append(u'</div>') if (_backup_attrs_38452616 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38452616 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37030800 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224cd0> name=None at 22244d0> -> _value _value = _static_35802320 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35875584 = get('default', _marker) # <Marker name='default' at 2224d10> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:${message}' (6:32)> -> _cache_35802448 try: _cache_35802448 = getitem('message') _cache_35802448 = _cache_35802448 except: rcontext.setdefault('__error__', []).append((u'string:${message}', 6, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:${message}' (6:32)> value=<Marker name='default' at 22243d0> at 2224090> -> _condition _expression = _cache_35802448 # <Marker name='default' at 22243d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35802448 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_35875584 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35875584 append(u'</div>') if (_backup_attrs_37030800 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37030800 # <Expression u'message' (7:6)> -> _content_139955154988272 try: _content_139955154988272 = getitem('message') except: rcontext.setdefault('__error__', []).append((u'message', 7, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35343752 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35343752 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35342528 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35342528 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/011-messages.pt.py����������������������������������������0000600�0001750�0000144�00000036702�11547550676�024315� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_38464336 = {} _static_38462992 = {} _static_35800464 = {} _static_38589648 = {} _static_35799184 = {} _static_38591312 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38435944 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224590> name=None at 2224e10> -> _value _value = _static_35800464 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35756224 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2224090> name=None at 22243d0> -> _value _value = _static_35799184 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35757952 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cdb50> name=None at 24cde50> -> _value _value = _static_38591312 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35754928 = get('default', _marker) # <Marker name='default' at 24cd810> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'message' (3:27)> -> _cache_35800272 try: _cache_35800272 = getitem('message') except: rcontext.setdefault('__error__', []).append((u'message', 3, 27, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'message' (3:27)> value=<Marker name='default' at 2317990> at 2317810> -> _condition _expression = _cache_35800272 # <Marker name='default' at 2317990> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_35800272 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35754928 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35754928 append(u'</div>') if (_backup_attrs_35757952 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35757952 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35754136 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cd4d0> name=None at 24cd390> -> _value _value = _static_38589648 econtext['attrs'] = _value # <div ... (4:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35755144 = get('default', _marker) # <Marker name='default' at 24cd590> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'message' (4:32)> -> _cache_38591632 try: _cache_38591632 = getitem('message') except: rcontext.setdefault('__error__', []).append((u'message', 4, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'message' (4:32)> value=<Marker name='default' at 24cd7d0> at 24cde90> -> _condition _expression = _cache_38591632 # <Marker name='default' at 24cd7d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38591632 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_35755144 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35755144 append(u'</div>') if (_backup_attrs_35754136 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35754136 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35756728 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24aeb50> name=None at 24aead0> -> _value _value = _static_38464336 econtext['attrs'] = _value # <div ... (5:4) # -------------------------------------------------------- append(u'<div>') _backup_default_35756008 = get('default', _marker) # <Marker name='default' at 24aeb90> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:${message}' (5:27)> -> _cache_38592208 try: _cache_38592208 = getitem('message') _cache_38592208 = _cache_38592208 except: rcontext.setdefault('__error__', []).append((u'string:${message}', 5, 27, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:${message}' (5:27)> value=<Marker name='default' at 222be10> at 222bd50> -> _condition _expression = _cache_38592208 # <Marker name='default' at 222be10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38592208 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35756008 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35756008 append(u'</div>') if (_backup_attrs_35756728 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35756728 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39036616 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae610> name=None at 24ae490> -> _value _value = _static_38462992 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _backup_default_37197080 = get('default', _marker) # <Marker name='default' at 24ae410> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:${message}' (6:32)> -> _cache_38465488 try: _cache_38465488 = getitem('message') _cache_38465488 = _cache_38465488 except: rcontext.setdefault('__error__', []).append((u'string:${message}', 6, 32, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:${message}' (6:32)> value=<Marker name='default' at 24ae3d0> at 24ae190> -> _condition _expression = _cache_38465488 # <Marker name='default' at 24ae3d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38465488 if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) if (_backup_default_37197080 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_37197080 append(u'</div>') if (_backup_attrs_39036616 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39036616 # <Expression u'message' (7:6)> -> _content_139955154988272 try: _content_139955154988272 = getitem('message') except: rcontext.setdefault('__error__', []).append((u'message', 7, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35756224 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35756224 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38435944 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38435944 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/011.xml���������������������������������������������������0000644�0001750�0000144�00000000200�11445675021�022213� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA #IMPLIED a2 CDATA #IMPLIED> ]> <doc a1="v1" a2="v2"></doc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/012-translation.pt����������������������������������������0000644�0001750�0000144�00000001067�12035501123�024372� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div i18n:translate=""></div> <div i18n:translate=""> Hello world! </div> <div i18n:translate="hello_world"> Hello world! </div> <div i18n:translate=""> <sup>Hello world!</sup> </div> <div i18n:translate=""> Hello <em i18n:name="first">${'world'}</em>! Goodbye <em i18n:name="second">${'planet'}</em>! </div> <div i18n:translate="hello_goodbye"> Hello <em i18n:name="first">${'world'}</em>! Goodbye <em i18n:name="second">${'planet'}</em>! </div> </body> </html> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/012-translation.pt-en.py����������������������������������0000600�0001750�0000144�00000052342�11547550677�025444� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_38488016 = {} _static_38579984 = {} _static_38488272 = {} _static_38487184 = {} _static_38579536 = {} _static_35831120 = {} _static_38489936 = {} _static_38487632 = {} _static_35883600 = {} _static_36668432 = {} _static_38576848 = {} _static_35331024 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38523248 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8410> name=None at 2372990> -> _value _value = _static_36668432 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38625792 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2238a50> name=None at 2238690> -> _value _value = _static_35883600 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38624936 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222bd50> name=None at 222be10> -> _value _value = _static_35831120 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _stream_35884752 = _DebuggingOutputStream() _append_35884752 = _stream_35884752.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_35884752(_content_139955154988272) _msgid_35884752 = re_whitespace(''.join(_stream_35884752)).strip() append(translate(_msgid_35884752, mapping=None, default=_msgid_35884752, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38624936 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38624936 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38619904 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x21b1bd0> name=None at 23171d0> -> _value _value = _static_35331024 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _stream_36796624 = _DebuggingOutputStream() _append_36796624 = _stream_36796624.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_36796624(_content_139955154988272) _msgid_36796624 = re_whitespace(''.join(_stream_36796624)).strip() append(translate(u'hello_world', mapping=None, default=_msgid_36796624, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38619904 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38619904 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38620264 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4f50> name=None at 24b4d10> -> _value _value = _static_38489936 econtext['attrs'] = _value # <div ... (9:4) # -------------------------------------------------------- append(u'<div>') _stream_38487504 = _DebuggingOutputStream() _append_38487504 = _stream_38487504.append _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38487504(_content_139955154988272) _backup_attrs_38617888 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b48d0> name=None at 24b4e10> -> _value _value = _static_38488272 econtext['attrs'] = _value # <sup ... (10:6) # -------------------------------------------------------- _append_38487504(u'<sup>') _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): _append_38487504(_content_139955154988272) _append_38487504(u'</sup>') if (_backup_attrs_38617888 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38617888 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38487504(_content_139955154988272) _msgid_38487504 = re_whitespace(''.join(_stream_38487504)).strip() append(translate(_msgid_38487504, mapping=None, default=_msgid_38487504, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38620264 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38620264 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38616672 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b47d0> name=None at 24b4890> -> _value _value = _static_38488016 econtext['attrs'] = _value # <div ... (12:4) # -------------------------------------------------------- append(u'<div>') _stream_35215016_first = '' _stream_35215016_second = '' _stream_38487888 = _DebuggingOutputStream() _append_38487888 = _stream_38487888.append _content_139955154988272 = u'\n Hello ' if (_content_139955154988272 is not None): _append_38487888(_content_139955154988272) _stream_35215016_first = _DebuggingOutputStream() _append_35215016_first = _stream_35215016_first.append _backup_attrs_39096120 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4650> name=None at 24b42d0> -> _value _value = _static_38487632 econtext['attrs'] = _value # <em ... (13:12) # -------------------------------------------------------- _append_35215016_first(u'<em>') # <Expression u"'world'" (13:36)> -> _content_139955154988272 try: _content_139955154988272 = 'world' except: rcontext.setdefault('__error__', []).append((u"'world'", 13, 36, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_first(_content_139955154988272) _append_35215016_first(u'</em>') if (_backup_attrs_39096120 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39096120 _append_38487888(u'${first}') _stream_35215016_first = ''.join(_stream_35215016_first) _content_139955154988272 = u'!\n Goodbye ' if (_content_139955154988272 is not None): _append_38487888(_content_139955154988272) _stream_35215016_second = _DebuggingOutputStream() _append_35215016_second = _stream_35215016_second.append _backup_attrs_39090152 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4490> name=None at 24b4150> -> _value _value = _static_38487184 econtext['attrs'] = _value # <em ... (14:14) # -------------------------------------------------------- _append_35215016_second(u'<em>') # <Expression u"'planet'" (14:39)> -> _content_139955154988272 try: _content_139955154988272 = 'planet' except: rcontext.setdefault('__error__', []).append((u"'planet'", 14, 39, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_second(_content_139955154988272) _append_35215016_second(u'</em>') if (_backup_attrs_39090152 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39090152 _append_38487888(u'${second}') _stream_35215016_second = ''.join(_stream_35215016_second) _content_139955154988272 = u'!\n ' if (_content_139955154988272 is not None): _append_38487888(_content_139955154988272) _msgid_38487888 = re_whitespace(''.join(_stream_38487888)).strip() append(translate(_msgid_38487888, mapping={u'second': _stream_35215016_second, u'first': _stream_35215016_first, }, default=_msgid_38487888, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38616672 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38616672 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39091376 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24caf10> name=None at 24ca850> -> _value _value = _static_38579984 econtext['attrs'] = _value # <div ... (16:4) # -------------------------------------------------------- append(u'<div>') _stream_35215016_first = '' _stream_35215016_second = '' _stream_38486672 = _DebuggingOutputStream() _append_38486672 = _stream_38486672.append _content_139955154988272 = u'\n Hello ' if (_content_139955154988272 is not None): _append_38486672(_content_139955154988272) _stream_35215016_first = _DebuggingOutputStream() _append_35215016_first = _stream_35215016_first.append _backup_attrs_39080520 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca2d0> name=None at 24cafd0> -> _value _value = _static_38576848 econtext['attrs'] = _value # <em ... (17:12) # -------------------------------------------------------- _append_35215016_first(u'<em>') # <Expression u"'world'" (17:36)> -> _content_139955154988272 try: _content_139955154988272 = 'world' except: rcontext.setdefault('__error__', []).append((u"'world'", 17, 36, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_first(_content_139955154988272) _append_35215016_first(u'</em>') if (_backup_attrs_39080520 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39080520 _append_38486672(u'${first}') _stream_35215016_first = ''.join(_stream_35215016_first) _content_139955154988272 = u'!\n Goodbye ' if (_content_139955154988272 is not None): _append_38486672(_content_139955154988272) _stream_35215016_second = _DebuggingOutputStream() _append_35215016_second = _stream_35215016_second.append _backup_attrs_39080592 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cad50> name=None at 24ca110> -> _value _value = _static_38579536 econtext['attrs'] = _value # <em ... (18:14) # -------------------------------------------------------- _append_35215016_second(u'<em>') # <Expression u"'planet'" (18:39)> -> _content_139955154988272 try: _content_139955154988272 = 'planet' except: rcontext.setdefault('__error__', []).append((u"'planet'", 18, 39, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_second(_content_139955154988272) _append_35215016_second(u'</em>') if (_backup_attrs_39080592 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39080592 _append_38486672(u'${second}') _stream_35215016_second = ''.join(_stream_35215016_second) _content_139955154988272 = u'!\n ' if (_content_139955154988272 is not None): _append_38486672(_content_139955154988272) _msgid_38486672 = re_whitespace(''.join(_stream_38486672)).strip() append(translate(u'hello_goodbye', mapping={u'second': _stream_35215016_second, u'first': _stream_35215016_first, }, default=_msgid_38486672, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_39091376 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39091376 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38625792 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38625792 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38523248 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38523248 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/012-translation.pt.py�������������������������������������0000600�0001750�0000144�00000052342�11547550677�025044� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_38489680 = {} _static_38487248 = {} _static_38578448 = {} _static_38486544 = {} _static_35828816 = {} _static_38488720 = {} _static_36670992 = {} _static_38579280 = {} _static_35884240 = {} _static_38486480 = {} _static_38578832 = {} _static_38486800 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38432352 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x222b450> name=None at 222bfd0> -> _value _value = _static_35828816 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38429976 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4310> name=None at 24b4a50> -> _value _value = _static_38486800 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38429832 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b44d0> name=None at 24b45d0> -> _value _value = _static_38487248 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _stream_38489104 = _DebuggingOutputStream() _append_38489104 = _stream_38489104.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_38489104(_content_139955154988272) _msgid_38489104 = re_whitespace(''.join(_stream_38489104)).strip() append(translate(_msgid_38489104, mapping=None, default=_msgid_38489104, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38429832 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38429832 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38412088 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4210> name=None at 24b4510> -> _value _value = _static_38486544 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _stream_38487760 = _DebuggingOutputStream() _append_38487760 = _stream_38487760.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_38487760(_content_139955154988272) _msgid_38487760 = re_whitespace(''.join(_stream_38487760)).strip() append(translate(u'hello_world', mapping=None, default=_msgid_38487760, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38412088 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38412088 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38411152 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4e50> name=None at 24b4950> -> _value _value = _static_38489680 econtext['attrs'] = _value # <div ... (9:4) # -------------------------------------------------------- append(u'<div>') _stream_38487888 = _DebuggingOutputStream() _append_38487888 = _stream_38487888.append _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38487888(_content_139955154988272) _backup_attrs_38409280 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4a90> name=None at 24b4f10> -> _value _value = _static_38488720 econtext['attrs'] = _value # <sup ... (10:6) # -------------------------------------------------------- _append_38487888(u'<sup>') _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): _append_38487888(_content_139955154988272) _append_38487888(u'</sup>') if (_backup_attrs_38409280 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38409280 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38487888(_content_139955154988272) _msgid_38487888 = re_whitespace(''.join(_stream_38487888)).strip() append(translate(_msgid_38487888, mapping=None, default=_msgid_38487888, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38411152 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38411152 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38408848 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b41d0> name=None at 24b4350> -> _value _value = _static_38486480 econtext['attrs'] = _value # <div ... (12:4) # -------------------------------------------------------- append(u'<div>') _stream_35215016_first = '' _stream_35215016_second = '' _stream_38489040 = _DebuggingOutputStream() _append_38489040 = _stream_38489040.append _content_139955154988272 = u'\n Hello ' if (_content_139955154988272 is not None): _append_38489040(_content_139955154988272) _stream_35215016_first = _DebuggingOutputStream() _append_35215016_first = _stream_35215016_first.append _backup_attrs_38460520 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cac50> name=None at 24ca050> -> _value _value = _static_38579280 econtext['attrs'] = _value # <em ... (13:12) # -------------------------------------------------------- _append_35215016_first(u'<em>') # <Expression u"'world'" (13:36)> -> _content_139955154988272 try: _content_139955154988272 = 'world' except: rcontext.setdefault('__error__', []).append((u"'world'", 13, 36, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_first(_content_139955154988272) _append_35215016_first(u'</em>') if (_backup_attrs_38460520 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38460520 _append_38489040(u'${first}') _stream_35215016_first = ''.join(_stream_35215016_first) _content_139955154988272 = u'!\n Goodbye ' if (_content_139955154988272 is not None): _append_38489040(_content_139955154988272) _stream_35215016_second = _DebuggingOutputStream() _append_35215016_second = _stream_35215016_second.append _backup_attrs_38461384 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca910> name=None at 24cae10> -> _value _value = _static_38578448 econtext['attrs'] = _value # <em ... (14:14) # -------------------------------------------------------- _append_35215016_second(u'<em>') # <Expression u"'planet'" (14:39)> -> _content_139955154988272 try: _content_139955154988272 = 'planet' except: rcontext.setdefault('__error__', []).append((u"'planet'", 14, 39, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_second(_content_139955154988272) _append_35215016_second(u'</em>') if (_backup_attrs_38461384 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38461384 _append_38489040(u'${second}') _stream_35215016_second = ''.join(_stream_35215016_second) _content_139955154988272 = u'!\n ' if (_content_139955154988272 is not None): _append_38489040(_content_139955154988272) _msgid_38489040 = re_whitespace(''.join(_stream_38489040)).strip() append(translate(_msgid_38489040, mapping={u'second': _stream_35215016_second, u'first': _stream_35215016_first, }, default=_msgid_38489040, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38408848 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38408848 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38459368 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24caa90> name=None at 24ca6d0> -> _value _value = _static_38578832 econtext['attrs'] = _value # <div ... (16:4) # -------------------------------------------------------- append(u'<div>') _stream_35215016_first = '' _stream_35215016_second = '' _stream_38578576 = _DebuggingOutputStream() _append_38578576 = _stream_38578576.append _content_139955154988272 = u'\n Hello ' if (_content_139955154988272 is not None): _append_38578576(_content_139955154988272) _stream_35215016_first = _DebuggingOutputStream() _append_35215016_first = _stream_35215016_first.append _backup_attrs_37105888 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2238cd0> name=None at 2238f90> -> _value _value = _static_35884240 econtext['attrs'] = _value # <em ... (17:12) # -------------------------------------------------------- _append_35215016_first(u'<em>') # <Expression u"'world'" (17:36)> -> _content_139955154988272 try: _content_139955154988272 = 'world' except: rcontext.setdefault('__error__', []).append((u"'world'", 17, 36, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_first(_content_139955154988272) _append_35215016_first(u'</em>') if (_backup_attrs_37105888 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37105888 _append_38578576(u'${first}') _stream_35215016_first = ''.join(_stream_35215016_first) _content_139955154988272 = u'!\n Goodbye ' if (_content_139955154988272 is not None): _append_38578576(_content_139955154988272) _stream_35215016_second = _DebuggingOutputStream() _append_35215016_second = _stream_35215016_second.append _backup_attrs_37108840 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8e10> name=None at 22f8510> -> _value _value = _static_36670992 econtext['attrs'] = _value # <em ... (18:14) # -------------------------------------------------------- _append_35215016_second(u'<em>') # <Expression u"'planet'" (18:39)> -> _content_139955154988272 try: _content_139955154988272 = 'planet' except: rcontext.setdefault('__error__', []).append((u"'planet'", 18, 39, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215016_second(_content_139955154988272) _append_35215016_second(u'</em>') if (_backup_attrs_37108840 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37108840 _append_38578576(u'${second}') _stream_35215016_second = ''.join(_stream_35215016_second) _content_139955154988272 = u'!\n ' if (_content_139955154988272 is not None): _append_38578576(_content_139955154988272) _msgid_38578576 = re_whitespace(''.join(_stream_38578576)).strip() append(translate(u'hello_goodbye', mapping={u'second': _stream_35215016_second, u'first': _stream_35215016_first, }, default=_msgid_38578576, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38459368 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38459368 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38429976 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38429976 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38432352 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38432352 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/012.xml���������������������������������������������������0000644�0001750�0000144�00000000144�11445675021�022223� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc : CDATA #IMPLIED> ]> <doc :="v1"></doc> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/013-repeat-nested.pt��������������������������������������0000644�0001750�0000144�00000000255�11445675021�024610� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <table> <tr tal:repeat="i (1,2)"> <td tal:repeat="j (1,2)"> [${i},${j}] </td> </tr> </table> </body> </html> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/013-repeat-nested.pt.py�����������������������������������0000600�0001750�0000144�00000026470�11547550677�025252� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_36668880 = {} _static_38578832 = {} _static_38579728 = {} _static_38579280 = {} _static_35883664 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35898288 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cac50> name=None at 24ca050> -> _value _value = _static_38579280 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38449232 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cae10> name=None at 24cadd0> -> _value _value = _static_38579728 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38451104 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24caa90> name=None at 24ca6d0> -> _value _value = _static_38578832 econtext['attrs'] = _value # <table ... (3:4) # -------------------------------------------------------- append(u'<table>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_38402704 = get('i', _marker) # <Expression u'(1,2)' (4:24)> -> _iterator try: _iterator = (1, 2, ) except: rcontext.setdefault('__error__', []).append((u'(1,2)', 4, 24, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_35889808, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_attrs_38450384 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f85d0> name=None at 2372f50> -> _value _value = _static_36668880 econtext['attrs'] = _value # <tr ... (4:6) # -------------------------------------------------------- append(u'<tr>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_j_34805456 = get('j', _marker) # <Expression u'(1,2)' (5:26)> -> _iterator try: _iterator = (1, 2, ) except: rcontext.setdefault('__error__', []).append((u'(1,2)', 5, 26, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_35883600, ) = getitem('repeat')(u'j', _iterator) econtext['j'] = None for _item in _iterator: econtext['j'] = _item _backup_attrs_38450744 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2238a90> name=None at 2238a10> -> _value _value = _static_35883664 econtext['attrs'] = _value # <td ... (5:8) # -------------------------------------------------------- append(u'<td>') # <Expression u'i' (6:13)> -> _content_139955154988272 try: _content_139955154988272 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 6, 13, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') # <Expression u'j' (6:18)> -> _content_139955154988272_110 try: _content_139955154988272_110 = getitem('j') except: rcontext.setdefault('__error__', []).append((u'j', 6, 18, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_110 is None): pass else: if (_content_139955154988272_110 is False): _content_139955154988272_110 = None else: _tt = type(_content_139955154988272_110) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_110 = unicode(_content_139955154988272_110) else: try: if (_tt is str): _content_139955154988272_110 = decode(_content_139955154988272_110) else: if (_tt is not unicode): try: _content_139955154988272_110 = _content_139955154988272_110.__html__ except: _content_139955154988272_110 = convert(_content_139955154988272_110) else: raise RuntimeError except RuntimeError: _content_139955154988272_110 = _content_139955154988272_110() else: if ((_content_139955154988272_110 is not None) and (re_needs_escape(_content_139955154988272_110) is not None)): if ('&' in _content_139955154988272_110): if (';' in _content_139955154988272_110): _content_139955154988272_110 = re_amp.sub('&', _content_139955154988272_110) else: _content_139955154988272_110 = _content_139955154988272_110.replace('&', '&') if ('<' in _content_139955154988272_110): _content_139955154988272_110 = _content_139955154988272_110.replace('<', '<') if ('>' in _content_139955154988272_110): _content_139955154988272_110 = _content_139955154988272_110.replace('>', '>') if ('\x00' in _content_139955154988272_110): _content_139955154988272_110 = _content_139955154988272_110.replace('\x00', '"') _content_139955154988272 = ('%s%s%s%s%s' % ((u'\n [' if (u'\n [' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u',' if (u',' is not None) else ''), (_content_139955154988272_110 if (_content_139955154988272_110 is not None) else ''), (u']\n ' if (u']\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</td>') if (_backup_attrs_38450744 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38450744 __index_35883600 -= 1 if (__index_35883600 > 0): append('\n ') if (_backup_j_34805456 is _marker): del econtext['j'] else: econtext['j'] = _backup_j_34805456 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</tr>') if (_backup_attrs_38450384 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38450384 __index_35889808 -= 1 if (__index_35889808 > 0): append('\n ') if (_backup_i_38402704 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_38402704 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</table>') if (_backup_attrs_38451104 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38451104 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38449232 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38449232 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35898288 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35898288 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/013.xml���������������������������������������������������0000644�0001750�0000144�00000000174�11445675021�022227� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc _.-0123456789 CDATA #IMPLIED> ]> <doc _.-0123456789="v1"></doc> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/014-repeat-nested-similar.pt������������������������������0000644�0001750�0000144�00000000202�11445675021�026237� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <span tal:repeat="i (3,4)"> <span tal:repeat="j (3,4)">[${i},${j}]</span> </span> </body> </html> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/014-repeat-nested-similar.pt.py���������������������������0000600�0001750�0000144�00000025001�11547550677�026676� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_36670928 = {} _static_35883856 = {} _static_38579280 = {} _static_38578448 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38460808 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2238b50> name=None at 2238f90> -> _value _value = _static_35883856 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38457496 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8dd0> name=None at 22f8610> -> _value _value = _static_36670928 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_38402704 = get('i', _marker) # <Expression u'(3,4)' (3:24)> -> _iterator try: _iterator = (3, 4, ) except: rcontext.setdefault('__error__', []).append((u'(3,4)', 3, 24, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_38579664, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_attrs_38524328 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cac50> name=None at 24ca050> -> _value _value = _static_38579280 econtext['attrs'] = _value # <span ... (3:4) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_j_35779152 = get('j', _marker) # <Expression u'(3,4)' (4:26)> -> _iterator try: _iterator = (3, 4, ) except: rcontext.setdefault('__error__', []).append((u'(3,4)', 4, 26, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_38578064, ) = getitem('repeat')(u'j', _iterator) econtext['j'] = None for _item in _iterator: econtext['j'] = _item _backup_attrs_38460304 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca910> name=None at 24cad10> -> _value _value = _static_38578448 econtext['attrs'] = _value # <span ... (4:6) # -------------------------------------------------------- append(u'<span>') # <Expression u'i' (4:36)> -> _content_139955154988272 try: _content_139955154988272 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 4, 36, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') # <Expression u'j' (4:41)> -> _content_139955154988272_87 try: _content_139955154988272_87 = getitem('j') except: rcontext.setdefault('__error__', []).append((u'j', 4, 41, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_87 is None): pass else: if (_content_139955154988272_87 is False): _content_139955154988272_87 = None else: _tt = type(_content_139955154988272_87) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_87 = unicode(_content_139955154988272_87) else: try: if (_tt is str): _content_139955154988272_87 = decode(_content_139955154988272_87) else: if (_tt is not unicode): try: _content_139955154988272_87 = _content_139955154988272_87.__html__ except: _content_139955154988272_87 = convert(_content_139955154988272_87) else: raise RuntimeError except RuntimeError: _content_139955154988272_87 = _content_139955154988272_87() else: if ((_content_139955154988272_87 is not None) and (re_needs_escape(_content_139955154988272_87) is not None)): if ('&' in _content_139955154988272_87): if (';' in _content_139955154988272_87): _content_139955154988272_87 = re_amp.sub('&', _content_139955154988272_87) else: _content_139955154988272_87 = _content_139955154988272_87.replace('&', '&') if ('<' in _content_139955154988272_87): _content_139955154988272_87 = _content_139955154988272_87.replace('<', '<') if ('>' in _content_139955154988272_87): _content_139955154988272_87 = _content_139955154988272_87.replace('>', '>') if ('\x00' in _content_139955154988272_87): _content_139955154988272_87 = _content_139955154988272_87.replace('\x00', '"') _content_139955154988272 = ('%s%s%s%s%s' % ((u'[' if (u'[' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u',' if (u',' is not None) else ''), (_content_139955154988272_87 if (_content_139955154988272_87 is not None) else ''), (u']' if (u']' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_38460304 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38460304 __index_38578064 -= 1 if (__index_38578064 > 0): append('\n ') if (_backup_j_35779152 is _marker): del econtext['j'] else: econtext['j'] = _backup_j_35779152 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_38524328 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38524328 __index_38579664 -= 1 if (__index_38579664 > 0): append('\n ') if (_backup_i_38402704 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_38402704 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38457496 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38457496 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38460808 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38460808 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/014.xml���������������������������������������������������0000644�0001750�0000144�00000000226�11445675021�022226� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc abcdefghijklmnopqrstuvwxyz CDATA #IMPLIED> ]> <doc abcdefghijklmnopqrstuvwxyz="v1"></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/015-translation-nested.pt���������������������������������0000644�0001750�0000144�00000000312�11445675021�025662� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div i18n:translate=""> Price: <span i18n:name="price" i18n:translate=""> Per kilo <em i18n:name="amount">${12.5}</em> </span> </div> </body> </html> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/015-translation-nested.pt-en.py���������������������������0000600�0001750�0000144�00000017374�11547550677�026735� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_36670928 = {} _static_38428304 = {} _static_38579280 = {} _static_38488592 = {} _static_38578448 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38960088 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8dd0> name=None at 22f8610> -> _value _value = _static_36670928 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38430264 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cac50> name=None at 24ca050> -> _value _value = _static_38579280 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39079448 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca910> name=None at 24cad10> -> _value _value = _static_38578448 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _stream_35215016_price = '' _stream_38577872 = _DebuggingOutputStream() _append_38577872 = _stream_38577872.append _content_139955154988272 = u'\n Price:\n ' if (_content_139955154988272 is not None): _append_38577872(_content_139955154988272) _stream_35215016_price = _DebuggingOutputStream() _append_35215016_price = _stream_35215016_price.append _backup_attrs_39124432 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24b4a10> name=None at 24b4d50> -> _value _value = _static_38488592 econtext['attrs'] = _value # <span ... (5:6) # -------------------------------------------------------- _append_35215016_price(u'<span>') _stream_35215248_amount = '' _stream_38576464 = _DebuggingOutputStream() _append_38576464 = _stream_38576464.append _content_139955154988272 = u'\n Per kilo ' if (_content_139955154988272 is not None): _append_38576464(_content_139955154988272) _stream_35215248_amount = _DebuggingOutputStream() _append_35215248_amount = _stream_35215248_amount.append _backup_attrs_38958432 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a5e90> name=None at 24a5bd0> -> _value _value = _static_38428304 econtext['attrs'] = _value # <em ... (6:17) # -------------------------------------------------------- _append_35215248_amount(u'<em>') # <Expression u'12.5' (6:42)> -> _content_139955154988272 try: _content_139955154988272 = 12.5 except: rcontext.setdefault('__error__', []).append((u'12.5', 6, 42, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215248_amount(_content_139955154988272) _append_35215248_amount(u'</em>') if (_backup_attrs_38958432 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38958432 _append_38576464(u'${amount}') _stream_35215248_amount = ''.join(_stream_35215248_amount) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38576464(_content_139955154988272) _msgid_38576464 = re_whitespace(''.join(_stream_38576464)).strip() _append_35215016_price(translate(_msgid_38576464, mapping={u'amount': _stream_35215248_amount, }, default=_msgid_38576464, domain=_i18n_domain)) _append_35215016_price(u'</span>') if (_backup_attrs_39124432 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39124432 _append_38577872(u'${price}') _stream_35215016_price = ''.join(_stream_35215016_price) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38577872(_content_139955154988272) _msgid_38577872 = re_whitespace(''.join(_stream_38577872)).strip() append(translate(_msgid_38577872, mapping={u'price': _stream_35215016_price, }, default=_msgid_38577872, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_39079448 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39079448 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38430264 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38430264 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38960088 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38960088 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/015-translation-nested.pt.py������������������������������0000600�0001750�0000144�00000017374�11547550677�026335� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_38579280 = {} _static_38425872 = {} _static_38427536 = {} _static_36668688 = {} _static_38576400 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38408776 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a5510> name=None at 24a59d0> -> _value _value = _static_38425872 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36681056 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a5b90> name=None at 24a5490> -> _value _value = _static_38427536 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37011112 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cac50> name=None at 24ca050> -> _value _value = _static_38579280 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _stream_35215016_price = '' _stream_38579984 = _DebuggingOutputStream() _append_38579984 = _stream_38579984.append _content_139955154988272 = u'\n Price:\n ' if (_content_139955154988272 is not None): _append_38579984(_content_139955154988272) _stream_35215016_price = _DebuggingOutputStream() _append_35215016_price = _stream_35215016_price.append _backup_attrs_38411512 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca110> name=None at 24cad90> -> _value _value = _static_38576400 econtext['attrs'] = _value # <span ... (5:6) # -------------------------------------------------------- _append_35215016_price(u'<span>') _stream_35215248_amount = '' _stream_38578448 = _DebuggingOutputStream() _append_38578448 = _stream_38578448.append _content_139955154988272 = u'\n Per kilo ' if (_content_139955154988272 is not None): _append_38578448(_content_139955154988272) _stream_35215248_amount = _DebuggingOutputStream() _append_35215248_amount = _stream_35215248_amount.append _backup_attrs_37011184 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8510> name=None at 24cacd0> -> _value _value = _static_36668688 econtext['attrs'] = _value # <em ... (6:17) # -------------------------------------------------------- _append_35215248_amount(u'<em>') # <Expression u'12.5' (6:42)> -> _content_139955154988272 try: _content_139955154988272 = 12.5 except: rcontext.setdefault('__error__', []).append((u'12.5', 6, 42, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = _content_139955154988272 if (_content_139955154988272 is not None): _append_35215248_amount(_content_139955154988272) _append_35215248_amount(u'</em>') if (_backup_attrs_37011184 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37011184 _append_38578448(u'${amount}') _stream_35215248_amount = ''.join(_stream_35215248_amount) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38578448(_content_139955154988272) _msgid_38578448 = re_whitespace(''.join(_stream_38578448)).strip() _append_35215016_price(translate(_msgid_38578448, mapping={u'amount': _stream_35215248_amount, }, default=_msgid_38578448, domain=_i18n_domain)) _append_35215016_price(u'</span>') if (_backup_attrs_38411512 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38411512 _append_38579984(u'${price}') _stream_35215016_price = ''.join(_stream_35215016_price) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38579984(_content_139955154988272) _msgid_38579984 = re_whitespace(''.join(_stream_38579984)).strip() append(translate(_msgid_38579984, mapping={u'price': _stream_35215016_price, }, default=_msgid_38579984, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_37011112 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37011112 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36681056 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36681056 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38408776 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38408776 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/015.xml���������������������������������������������������0000644�0001750�0000144�00000000226�11445675021�022227� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc ABCDEFGHIJKLMNOPQRSTUVWXYZ CDATA #IMPLIED> ]> <doc ABCDEFGHIJKLMNOPQRSTUVWXYZ="v1"></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/016-explicit-translation.pt�������������������������������0000644�0001750�0000144�00000000626�11445675021�026232� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div i18n:translate="" tal:content="string:Hello world!"> Hello world! </div> <img alt="${'Hello world!'}" i18n:attributes="alt" /> <img alt="${'Hello world!'}" i18n:attributes="alt hello_world" /> <img tal:attributes="alt 'Hello world!'" i18n:attributes="alt" /> <img tal:attributes="alt 'Hello world!'" i18n:attributes="alt hello_world" /> </body> </html> ����������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/016-explicit-translation.pt-en.py�������������������������0000600�0001750�0000144�00000037541�11547550677�027273� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_37011728 = {u'alt': u"${'Hello world!'}", } _static_38463824 = {u'alt': u"'Hello world!'", } _static_38579664 = {} _static_38427088 = {} _static_38579728 = {} _static_38425616 = {u'alt': u"${'Hello world!'}", } _static_38465488 = {u'alt': u"'Hello world!'", } _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_36729560 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cadd0> name=None at 22f8e50> -> _value _value = _static_38579664 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36729920 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cae10> name=None at 24caf10> -> _value _value = _static_38579728 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35804152 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a59d0> name=None at 24a5690> -> _value _value = _static_38427088 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36732008 = get('default', _marker) # <Marker name='default' at 24ca410> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:Hello world!' (3:40)> -> _cache_38578448 try: _cache_38578448 = u'Hello world!' except: rcontext.setdefault('__error__', []).append((u'string:Hello world!', 3, 40, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:Hello world!' (3:40)> value=<Marker name='default' at 24cae90> at 24cacd0> -> _condition _expression = _cache_38578448 # <Marker name='default' at 24cae90> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_38578448 _content = translate(_content, default=None, domain=_i18n_domain) if (_content is not None): append(_content) if (_backup_default_36732008 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36732008 append(u'</div>') if (_backup_attrs_35804152 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35804152 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36729776 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a5410> name=None at 24a5b90> -> _value _value = _static_38425616 econtext['attrs'] = _value # <img ... (6:4) # -------------------------------------------------------- append(u'<img') _backup_default_36729128 = get('default', _marker) _value = u"${'Hello world!'}" econtext['default'] = _value # <Translate msgid=None node=<Interpolation value=u"${'Hello world!'}" escape=True at 24a5bd0> at 24a5a90> -> _attr_alt # <Interpolation value=u"${'Hello world!'}" escape=True at 24a5bd0> -> _attr_alt # <Expression u"'Hello world!'" (6:16)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 6, 16, '<string>', _sys.exc_info()[1], )) raise _attr_alt = _attr_alt _attr_alt = translate(_attr_alt, default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if (u'"' in _attr_alt): _attr_alt = _attr_alt.replace(u'"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_36729128 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36729128 append(u' />') if (_backup_attrs_36729776 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36729776 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35874000 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x234c110> name=None at 234ce10> -> _value _value = _static_37011728 econtext['attrs'] = _value # <img ... (7:4) # -------------------------------------------------------- append(u'<img') _backup_default_35876808 = get('default', _marker) _value = u"${'Hello world!'}" econtext['default'] = _value # <Translate msgid=u'hello_world' node=<Interpolation value=u"${'Hello world!'}" escape=True at 234ce50> at 234c9d0> -> _attr_alt # <Interpolation value=u"${'Hello world!'}" escape=True at 234ce50> -> _attr_alt # <Expression u"'Hello world!'" (7:16)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 7, 16, '<string>', _sys.exc_info()[1], )) raise _attr_alt = _attr_alt _attr_alt = translate(u'hello_world', default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if (u'"' in _attr_alt): _attr_alt = _attr_alt.replace(u'"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_35876808 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35876808 append(u' />') if (_backup_attrs_35874000 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35874000 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35875152 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24aefd0> name=None at 24aebd0> -> _value _value = _static_38465488 econtext['attrs'] = _value # <img ... (8:4) # -------------------------------------------------------- append(u'<img') _backup_default_35874072 = get('default', _marker) _value = None econtext['default'] = _value # <Translate msgid=None node=<Expression u"'Hello world!'" (8:29)> at 24aead0> -> _attr_alt # <Expression u"'Hello world!'" (8:29)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 8, 29, '<string>', _sys.exc_info()[1], )) raise _attr_alt = translate(_attr_alt, default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if ('"' in _attr_alt): _attr_alt = _attr_alt.replace('"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_35874072 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35874072 append(u' />') if (_backup_attrs_35875152 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35875152 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35872848 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae950> name=None at 24ae910> -> _value _value = _static_38463824 econtext['attrs'] = _value # <img ... (9:4) # -------------------------------------------------------- append(u'<img') _backup_default_35873208 = get('default', _marker) _value = None econtext['default'] = _value # <Translate msgid=u'hello_world' node=<Expression u"'Hello world!'" (9:29)> at 24ae890> -> _attr_alt # <Expression u"'Hello world!'" (9:29)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 9, 29, '<string>', _sys.exc_info()[1], )) raise _attr_alt = translate(u'hello_world', default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if ('"' in _attr_alt): _attr_alt = _attr_alt.replace('"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_35873208 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35873208 append(u' />') if (_backup_attrs_35872848 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35872848 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36729920 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36729920 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_36729560 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36729560 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/016-explicit-translation.pt.py����������������������������0000600�0001750�0000144�00000037541�11547550677�026673� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_38461520 = {u'alt': u"'Hello world!'", } _static_38577424 = {} _static_38427984 = {} _static_38578896 = {u'alt': u"${'Hello world!'}", } _static_38401104 = {u'alt': u"'Hello world!'", } _static_38462480 = {u'alt': u"${'Hello world!'}", } _static_38428112 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_37150016 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a5dd0> name=None at 24a59d0> -> _value _value = _static_38428112 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36785184 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a5d50> name=None at 24a5a50> -> _value _value = _static_38427984 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38523176 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca510> name=None at 24ca9d0> -> _value _value = _static_38577424 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_36784176 = get('default', _marker) # <Marker name='default' at 24cae10> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'string:Hello world!' (3:40)> -> _cache_38578576 try: _cache_38578576 = u'Hello world!' except: rcontext.setdefault('__error__', []).append((u'string:Hello world!', 3, 40, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'string:Hello world!' (3:40)> value=<Marker name='default' at 24ca890> at 24ca110> -> _condition _expression = _cache_38578576 # <Marker name='default' at 24ca890> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_38578576 _content = translate(_content, default=None, domain=_i18n_domain) if (_content is not None): append(_content) if (_backup_default_36784176 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36784176 append(u'</div>') if (_backup_attrs_38523176 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38523176 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36793448 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24caad0> name=None at 24cae90> -> _value _value = _static_38578896 econtext['attrs'] = _value # <img ... (6:4) # -------------------------------------------------------- append(u'<img') _backup_default_36792152 = get('default', _marker) _value = u"${'Hello world!'}" econtext['default'] = _value # <Translate msgid=None node=<Interpolation value=u"${'Hello world!'}" escape=True at 24ae090> at 24ae190> -> _attr_alt # <Interpolation value=u"${'Hello world!'}" escape=True at 24ae090> -> _attr_alt # <Expression u"'Hello world!'" (6:16)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 6, 16, '<string>', _sys.exc_info()[1], )) raise _attr_alt = _attr_alt _attr_alt = translate(_attr_alt, default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if (u'"' in _attr_alt): _attr_alt = _attr_alt.replace(u'"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_36792152 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36792152 append(u' />') if (_backup_attrs_36793448 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36793448 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37151448 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae410> name=None at 24ae310> -> _value _value = _static_38462480 econtext['attrs'] = _value # <img ... (7:4) # -------------------------------------------------------- append(u'<img') _backup_default_37154184 = get('default', _marker) _value = u"${'Hello world!'}" econtext['default'] = _value # <Translate msgid=u'hello_world' node=<Interpolation value=u"${'Hello world!'}" escape=True at 24ae9d0> at 24aecd0> -> _attr_alt # <Interpolation value=u"${'Hello world!'}" escape=True at 24ae9d0> -> _attr_alt # <Expression u"'Hello world!'" (7:16)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 7, 16, '<string>', _sys.exc_info()[1], )) raise _attr_alt = _attr_alt _attr_alt = translate(u'hello_world', default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if (u'"' in _attr_alt): _attr_alt = _attr_alt.replace(u'"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_37154184 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_37154184 append(u' />') if (_backup_attrs_37151448 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37151448 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37152528 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae050> name=None at 24ae210> -> _value _value = _static_38461520 econtext['attrs'] = _value # <img ... (8:4) # -------------------------------------------------------- append(u'<img') _backup_default_37151520 = get('default', _marker) _value = None econtext['default'] = _value # <Translate msgid=None node=<Expression u"'Hello world!'" (8:29)> at 24ae750> -> _attr_alt # <Expression u"'Hello world!'" (8:29)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 8, 29, '<string>', _sys.exc_info()[1], )) raise _attr_alt = translate(_attr_alt, default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if ('"' in _attr_alt): _attr_alt = _attr_alt.replace('"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_37151520 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_37151520 append(u' />') if (_backup_attrs_37152528 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37152528 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_37151088 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f450> name=None at 249fcd0> -> _value _value = _static_38401104 econtext['attrs'] = _value # <img ... (9:4) # -------------------------------------------------------- append(u'<img') _backup_default_37154472 = get('default', _marker) _value = None econtext['default'] = _value # <Translate msgid=u'hello_world' node=<Expression u"'Hello world!'" (9:29)> at 249fc50> -> _attr_alt # <Expression u"'Hello world!'" (9:29)> -> _attr_alt try: _attr_alt = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 9, 29, '<string>', _sys.exc_info()[1], )) raise _attr_alt = translate(u'hello_world', default=_attr_alt, domain=_i18n_domain) if (_attr_alt is None): pass else: if (_attr_alt is False): _attr_alt = None else: _tt = type(_attr_alt) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_alt = unicode(_attr_alt) else: try: if (_tt is str): _attr_alt = decode(_attr_alt) else: if (_tt is not unicode): try: _attr_alt = _attr_alt.__html__ except: _attr_alt = convert(_attr_alt) else: raise RuntimeError except RuntimeError: _attr_alt = _attr_alt() else: if ((_attr_alt is not None) and (re_needs_escape(_attr_alt) is not None)): if ('&' in _attr_alt): if (';' in _attr_alt): _attr_alt = re_amp.sub('&', _attr_alt) else: _attr_alt = _attr_alt.replace('&', '&') if ('<' in _attr_alt): _attr_alt = _attr_alt.replace('<', '<') if ('>' in _attr_alt): _attr_alt = _attr_alt.replace('>', '>') if ('"' in _attr_alt): _attr_alt = _attr_alt.replace('"', '"') if (_attr_alt is not None): append((u' alt="%s"' % _attr_alt)) if (_backup_default_37154472 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_37154472 append(u' />') if (_backup_attrs_37151088 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37151088 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36785184 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36785184 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_37150016 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37150016 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/016.xml���������������������������������������������������0000644�0001750�0000144�00000000102�11445675021�022221� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><?pi?></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/017-omit-tag.pt�������������������������������������������0000644�0001750�0000144�00000000555�11447161567�023607� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:omit-tag="">Hello world!</div> <div tal:omit-tag="">1 Hello world! 2</div>3 4<div tal:omit-tag="True">Hello world!</div> <div tal:omit-tag="False">Hello world!</div> <div class="omitted" tal:omit-tag="True">Hello world!</div> <div class="${'omitted'}" tal:omit-tag="True">Hello world!</div> </body> </html>���������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/017-omit-tag.pt.py����������������������������������������0000600�0001750�0000144�00000023573�11547550677�024240� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_38461840 = {} _static_38461520 = {} _static_38576336 = {u'class': u"${'omitted'}", } _static_38578640 = {u'class': u'omitted', } _static_38464592 = {} _static_38400400 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38457568 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae190> name=None at 24aebd0> -> _value _value = _static_38461840 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36649800 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24aec50> name=None at 24ae510> -> _value _value = _static_38464592 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'1\n Hello world!\n 2' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'3\n 4' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Negate value=<Expression u'True' (7:23)> at 249f690> -> _cache_38401680 # <Expression u'True' (7:23)> -> _cache_38401680 try: _cache_38401680 = True except: rcontext.setdefault('__error__', []).append((u'True', 7, 23, '<string>', _sys.exc_info()[1], )) raise _cache_38401680 = not _cache_38401680 _backup_attrs_38602080 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ae050> name=None at 24ae210> -> _value _value = _static_38461520 econtext['attrs'] = _value _condition = _cache_38401680 if _condition: # <div ... (7:4) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): append(_content_139955154988272) _condition = _cache_38401680 if _condition: append(u'</div>') if (_backup_attrs_38602080 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38602080 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Negate value=<Expression u'False' (8:23)> at 249f750> -> _cache_38401872 # <Expression u'False' (8:23)> -> _cache_38401872 try: _cache_38401872 = False except: rcontext.setdefault('__error__', []).append((u'False', 8, 23, '<string>', _sys.exc_info()[1], )) raise _cache_38401872 = not _cache_38401872 _backup_attrs_37106464 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f190> name=None at 249f950> -> _value _value = _static_38400400 econtext['attrs'] = _value _condition = _cache_38401872 if _condition: # <div ... (8:4) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): append(_content_139955154988272) _condition = _cache_38401872 if _condition: append(u'</div>') if (_backup_attrs_37106464 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37106464 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Negate value=<Expression u'True' (9:39)> at 24cae10> -> _cache_38579728 # <Expression u'True' (9:39)> -> _cache_38579728 try: _cache_38579728 = True except: rcontext.setdefault('__error__', []).append((u'True', 9, 39, '<string>', _sys.exc_info()[1], )) raise _cache_38579728 = not _cache_38579728 _backup_attrs_37107904 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca9d0> name=None at 24ca490> -> _value _value = _static_38578640 econtext['attrs'] = _value _condition = _cache_38579728 if _condition: # <div ... (9:4) # -------------------------------------------------------- append(u'<div') _attr_class = u'omitted' if (_attr_class is not None): append((u' class="%s"' % _attr_class)) append(u'>') _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): append(_content_139955154988272) _condition = _cache_38579728 if _condition: append(u'</div>') if (_backup_attrs_37107904 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37107904 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Negate value=<Expression u'True' (10:44)> at 24a5f90> -> _cache_38428560 # <Expression u'True' (10:44)> -> _cache_38428560 try: _cache_38428560 = True except: rcontext.setdefault('__error__', []).append((u'True', 10, 44, '<string>', _sys.exc_info()[1], )) raise _cache_38428560 = not _cache_38428560 _backup_attrs_37108768 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca0d0> name=None at 24caad0> -> _value _value = _static_38576336 econtext['attrs'] = _value _condition = _cache_38428560 if _condition: # <div ... (10:4) # -------------------------------------------------------- append(u'<div') _backup_default_36682712 = get('default', _marker) _value = u"${'omitted'}" econtext['default'] = _value # <Interpolation value=u"${'omitted'}" escape=True at 24ca050> -> _attr_class # <Expression u"'omitted'" (10:18)> -> _attr_class try: _attr_class = 'omitted' except: rcontext.setdefault('__error__', []).append((u"'omitted'", 10, 18, '<string>', _sys.exc_info()[1], )) raise _attr_class = _attr_class if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_36682712 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36682712 append(u'>') _content_139955154988272 = u'Hello world!' if (_content_139955154988272 is not None): append(_content_139955154988272) _condition = _cache_38428560 if _condition: append(u'</div>') if (_backup_attrs_37108768 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37108768 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_36649800 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36649800 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38457568 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38457568 pass�������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/017.xml���������������������������������������������������0000644�0001750�0000144�00000000123�11445675021�022225� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><?pi some data ? > <??></doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/018-translation-nested-dynamic.pt�������������������������0000644�0001750�0000144�00000000656�11447165360�027324� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<div xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://xml.zope.org/namespaces/i18n"> <div i18n:translate="" tal:omit-tag=""> <span i18n:name="monthname" i18n:translate="" tal:content="'october'" tal:omit-tag="">monthname</span> <span i18n:name="year" i18n:translate="" tal:content="1982" tal:omit-tag="">year</span> </div> </div> ����������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/018-translation-nested-dynamic.pt-en.py�������������������0000600�0001750�0000144�00000012533�11547550677�030352� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_38577168 = {u'xmlns': u'http://www.w3.org/1999/xhtml', } _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38450168 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24ca410> name=None at 24ca490> -> _value _value = _static_38577168 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div') _attr_xmlns = u'http://www.w3.org/1999/xhtml' if (_attr_xmlns is not None): append((u' xmlns="%s"' % _attr_xmlns)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _stream_35214320_year = '' _stream_35214320_monthname = '' _stream_38579664 = _DebuggingOutputStream() _append_38579664 = _stream_38579664.append _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38579664(_content_139955154988272) _stream_35214320_monthname = _DebuggingOutputStream() _append_35214320_monthname = _stream_35214320_monthname.append _backup_default_38618392 = get('default', _marker) # <Marker name='default' at 24ae690> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'october'" (6:25)> -> _cache_38463888 try: _cache_38463888 = 'october' except: rcontext.setdefault('__error__', []).append((u"'october'", 6, 25, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'october'" (6:25)> value=<Marker name='default' at 24ae150> at 24ae890> -> _condition _expression = _cache_38463888 # <Marker name='default' at 24ae150> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'monthname' if (_content_139955154988272 is not None): _append_35214320_monthname(_content_139955154988272) else: _content = _cache_38463888 _content = translate(_content, default=None, domain=_i18n_domain) if (_content is not None): _append_35214320_monthname(_content) if (_backup_default_38618392 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38618392 _append_38579664(u'${monthname}') _stream_35214320_monthname = ''.join(_stream_35214320_monthname) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38579664(_content_139955154988272) _stream_35214320_year = _DebuggingOutputStream() _append_35214320_year = _stream_35214320_year.append _backup_default_36748968 = get('default', _marker) # <Marker name='default' at 24a5dd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'1982' (10:25)> -> _cache_38427600 try: _cache_38427600 = 1982 except: rcontext.setdefault('__error__', []).append((u'1982', 10, 25, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'1982' (10:25)> value=<Marker name='default' at 24a5410> at 24a5f90> -> _condition _expression = _cache_38427600 # <Marker name='default' at 24a5410> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'year' if (_content_139955154988272 is not None): _append_35214320_year(_content_139955154988272) else: _content = _cache_38427600 _content = translate(_content, default=None, domain=_i18n_domain) if (_content is not None): _append_35214320_year(_content) if (_backup_default_36748968 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36748968 _append_38579664(u'${year}') _stream_35214320_year = ''.join(_stream_35214320_year) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38579664(_content_139955154988272) _msgid_38579664 = re_whitespace(''.join(_stream_38579664)).strip() append(translate(_msgid_38579664, mapping={u'monthname': _stream_35214320_monthname, u'year': _stream_35214320_year, }, default=_msgid_38579664, domain=_i18n_domain)) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_38450168 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38450168 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/018-translation-nested-dynamic.pt.py����������������������0000600�0001750�0000144�00000012533�11547550677�027752� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_38400080 = {u'xmlns': u'http://www.w3.org/1999/xhtml', } _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_37147352 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f050> name=None at 249f250> -> _value _value = _static_38400080 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div') _attr_xmlns = u'http://www.w3.org/1999/xhtml' if (_attr_xmlns is not None): append((u' xmlns="%s"' % _attr_xmlns)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _stream_35214320_year = '' _stream_35214320_monthname = '' _stream_38401104 = _DebuggingOutputStream() _append_38401104 = _stream_38401104.append _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38401104(_content_139955154988272) _stream_35214320_monthname = _DebuggingOutputStream() _append_35214320_monthname = _stream_35214320_monthname.append _backup_default_38434648 = get('default', _marker) # <Marker name='default' at 24ca150> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'october'" (6:25)> -> _cache_38577296 try: _cache_38577296 = 'october' except: rcontext.setdefault('__error__', []).append((u"'october'", 6, 25, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'october'" (6:25)> value=<Marker name='default' at 24ca410> at 24ca510> -> _condition _expression = _cache_38577296 # <Marker name='default' at 24ca410> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'monthname' if (_content_139955154988272 is not None): _append_35214320_monthname(_content_139955154988272) else: _content = _cache_38577296 _content = translate(_content, default=None, domain=_i18n_domain) if (_content is not None): _append_35214320_monthname(_content) if (_backup_default_38434648 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38434648 _append_38401104(u'${monthname}') _stream_35214320_monthname = ''.join(_stream_35214320_monthname) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38401104(_content_139955154988272) _stream_35214320_year = _DebuggingOutputStream() _append_35214320_year = _stream_35214320_year.append _backup_default_38436304 = get('default', _marker) # <Marker name='default' at 24ca050> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'1982' (10:25)> -> _cache_38577872 try: _cache_38577872 = 1982 except: rcontext.setdefault('__error__', []).append((u'1982', 10, 25, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'1982' (10:25)> value=<Marker name='default' at 24caa10> at 24cacd0> -> _condition _expression = _cache_38577872 # <Marker name='default' at 24caa10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'year' if (_content_139955154988272 is not None): _append_35214320_year(_content_139955154988272) else: _content = _cache_38577872 _content = translate(_content, default=None, domain=_i18n_domain) if (_content is not None): _append_35214320_year(_content) if (_backup_default_38436304 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38436304 _append_38401104(u'${year}') _stream_35214320_year = ''.join(_stream_35214320_year) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): _append_38401104(_content_139955154988272) _msgid_38401104 = re_whitespace(''.join(_stream_38401104)).strip() append(translate(_msgid_38401104, mapping={u'monthname': _stream_35214320_monthname, u'year': _stream_35214320_year, }, default=_msgid_38401104, domain=_i18n_domain)) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_37147352 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37147352 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/018.xml���������������������������������������������������0000644�0001750�0000144�00000000115�11445675021�022227� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><![CDATA[<foo>]]></doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/019-replace.pt��������������������������������������������0000644�0001750�0000144�00000000575�11445675021�023476� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:replace="'Hello world!'" /> <div tal:replace="'Hello world!'" />1 2<div tal:replace="'Hello world!'" /> <div tal:replace="'Hello world!'" />3 <div tal:replace="'Hello world!'">4</div>5 6<div tal:replace="'Hello world!'"></div> <div tal:replace="1" /> <div tal:replace="1.0" /> <div tal:replace="True" /> </body> </html> �����������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/019-replace.pt.py�����������������������������������������0000600�0001750�0000144�00000076713�11547550677�024140� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_36788688 = {} _static_36744848 = {} _static_38465168 = {} _static_38401424 = {} _static_38427088 = {} _static_38579856 = {} _static_37141712 = {} _static_37140688 = {} _static_36790160 = {} _static_36789584 = {} _static_37141776 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39046608 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24aee90> name=None at 24ae750> -> _value _value = _static_38465168 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35794168 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24a59d0> name=None at 24a5690> -> _value _value = _static_38427088 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_38452904 = get('default', _marker) # <Marker name='default' at 236b550> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (3:22)> -> _cache_36742672 try: _cache_36742672 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 3, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (3:22)> value=<Marker name='default' at 230a750> at 230ac90> -> _condition _expression = _cache_36742672 # <Marker name='default' at 230a750> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_35754136 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x230ae90> name=None at 24a5e90> -> _value _value = _static_36744848 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_35754136 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35754136 else: _content = _cache_36742672 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38452904 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38452904 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39065936 = get('default', _marker) # <Marker name='default' at 236b910> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (4:22)> -> _cache_37138960 try: _cache_37138960 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 4, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (4:22)> value=<Marker name='default' at 236bf10> at 236b250> -> _condition _expression = _cache_37138960 # <Marker name='default' at 236bf10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39064568 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bcd0> name=None at 236b5d0> -> _value _value = _static_37141712 econtext['attrs'] = _value # <div ... (4:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_39064568 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39064568 else: _content = _cache_37138960 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39065936 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39065936 _content_139955154988272 = u'1\n 2' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39065000 = get('default', _marker) # <Marker name='default' at 236b650> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (5:22)> -> _cache_37140112 try: _cache_37140112 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 5, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (5:22)> value=<Marker name='default' at 236bb90> at 236b3d0> -> _condition _expression = _cache_37140112 # <Marker name='default' at 236bb90> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39067304 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b8d0> name=None at 236bbd0> -> _value _value = _static_37140688 econtext['attrs'] = _value # <div ... (5:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_39067304 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39067304 else: _content = _cache_37140112 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39065000 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39065000 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39095472 = get('default', _marker) # <Marker name='default' at 249f290> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (6:22)> -> _cache_38401040 try: _cache_38401040 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 6, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (6:22)> value=<Marker name='default' at 249f750> at 249f210> -> _condition _expression = _cache_38401040 # <Marker name='default' at 249f750> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39095400 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bd10> name=None at 236b590> -> _value _value = _static_37141776 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_39095400 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39095400 else: _content = _cache_38401040 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39095472 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39095472 _content_139955154988272 = u'3\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35897496 = get('default', _marker) # <Marker name='default' at 24caa90> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (7:22)> -> _cache_38403600 try: _cache_38403600 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 7, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (7:22)> value=<Marker name='default' at 249fc50> at 249f950> -> _condition _expression = _cache_38403600 # <Marker name='default' at 249fc50> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_35900880 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f590> name=None at 249f450> -> _value _value = _static_38401424 econtext['attrs'] = _value # <div ... (7:4) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'4' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_35900880 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35900880 else: _content = _cache_38403600 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35897496 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35897496 _content_139955154988272 = u'5\n 6' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_38618392 = get('default', _marker) # <Marker name='default' at 24ca150> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello world!'" (8:22)> -> _cache_38578576 try: _cache_38578576 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 8, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello world!'" (8:22)> value=<Marker name='default' at 24cadd0> at 24caa10> -> _condition _expression = _cache_38578576 # <Marker name='default' at 24cadd0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_35899152 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x24cae90> name=None at 24ca510> -> _value _value = _static_38579856 econtext['attrs'] = _value # <div ... (8:4) # -------------------------------------------------------- append(u'<div>') append(u'</div>') if (_backup_attrs_35899152 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35899152 else: _content = _cache_38578576 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38618392 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38618392 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_38617960 = get('default', _marker) # <Marker name='default' at 2315510> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'1' (9:22)> -> _cache_36790096 try: _cache_36790096 = 1 except: rcontext.setdefault('__error__', []).append((u'1', 9, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'1' (9:22)> value=<Marker name='default' at 2315690> at 23155d0> -> _condition _expression = _cache_36790096 # <Marker name='default' at 2315690> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_38618320 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315f90> name=None at 23154d0> -> _value _value = _static_36790160 econtext['attrs'] = _value # <div ... (9:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_38618320 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38618320 else: _content = _cache_36790096 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38617960 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38617960 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_38631256 = get('default', _marker) # <Marker name='default' at 2315dd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'1.0' (10:22)> -> _cache_36789200 try: _cache_36789200 = 1.0 except: rcontext.setdefault('__error__', []).append((u'1.0', 10, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'1.0' (10:22)> value=<Marker name='default' at 2315c10> at 2315a10> -> _condition _expression = _cache_36789200 # <Marker name='default' at 2315c10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_38619832 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315d50> name=None at 2315190> -> _value _value = _static_36789584 econtext['attrs'] = _value # <div ... (10:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_38619832 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38619832 else: _content = _cache_36789200 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38631256 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38631256 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_38647928 = get('default', _marker) # <Marker name='default' at 2315290> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'True' (11:22)> -> _cache_36789072 try: _cache_36789072 = True except: rcontext.setdefault('__error__', []).append((u'True', 11, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'True' (11:22)> value=<Marker name='default' at 23157d0> at 2315b90> -> _condition _expression = _cache_36789072 # <Marker name='default' at 23157d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39044664 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x23159d0> name=None at 2315110> -> _value _value = _static_36788688 econtext['attrs'] = _value # <div ... (11:4) # -------------------------------------------------------- append(u'<div />') if (_backup_attrs_39044664 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39044664 else: _content = _cache_36789072 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38647928 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38647928 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35794168 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35794168 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_39046608 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39046608 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�����������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/019.xml���������������������������������������������������0000644�0001750�0000144�00000000112�11445675021�022225� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><![CDATA[<&]]></doc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/020-on-error.pt�������������������������������������������0000644�0001750�0000144�00000000610�11762130500�023572� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div id="test" tal:attributes="class python: 'abc' + 2" tal:on-error="nothing" /> <div tal:on-error="string:${type(error.value).__name__} thrown at ${error.lineno}:${error.offset}."> <div tal:content="undefined" /> </div> <div tal:replace="undefined" tal:on-error="nothing" /> <div tal:content="undefined" tal:on-error="nothing" /> </body> </html> ������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/020-on-error.pt.py����������������������������������������0000600�0001750�0000144�00000015411�11547550677�024244� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_37141392 = {} _static_37138960 = {} _static_36743056 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_40147424 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x230a790> name=None at 230a490> -> _value _value = _static_36743056 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) __fallback_34354496 = len(stream) try: _backup_attrs_40147568 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b210> name=None at 236b490> -> _value _value = _static_37138960 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_40167832 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bb90> name=None at 236b3d0> -> _value _value = _static_37141392 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _backup_default_40145120 = get('default', _marker) # <Marker name='default' at 236b690> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'undefined' (3:22)> -> _cache_37138512 try: _cache_37138512 = getitem('undefined') except: rcontext.setdefault('__error__', []).append((u'undefined', 3, 22, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'undefined' (3:22)> value=<Marker name='default' at 236b7d0> at 236bfd0> -> _condition _expression = _cache_37138512 # <Marker name='default' at 236b7d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_37138512 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_40145120 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_40145120 append(u'</div>') if (_backup_attrs_40167832 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_40167832 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_40147568 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_40147568 except (NameError, ValueError, AttributeError, LookupError, TypeError, ): del stream[__fallback_34354496:] # <Expression u'string:error' (2:22)> -> _content try: _content = u'error' except: rcontext.setdefault('__error__', []).append((u'string:error', 2, 22, '<string>', _sys.exc_info()[1], )) raise if (_content is not None): _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = str(_content) else: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except AttributeError: _content = convert(_content) else: _content = _content() if (_content is not None): append(_content) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_40147424 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_40147424 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/020.xml���������������������������������������������������0000644�0001750�0000144�00000000115�11445675021�022220� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><![CDATA[<&]>]]]></doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/021-translation-domain.pt���������������������������������0000644�0001750�0000144�00000000603�11445675021�025647� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body i18n:domain="old"> <div i18n:domain="new" i18n:translate=""> Hello world! </div> <div i18n:translate=""> Hello world! </div> <div class="test" i18n:domain="new" i18n:attributes="class"> Hello world! </div> <div class="test" i18n:domain="new" i18n:attributes="class test_msgid"> Hello world! </div> </body> </html> �����������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/021-translation-domain.pt-en.py���������������������������0000600�0001750�0000144�00000024665�11547550677�026720� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_37140048 = {} _static_38400656 = {} _static_36787600 = {u'class': u'test', } _static_37140688 = {} _static_38402256 = {u'class': u'test', } _static_37142352 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39931128 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bf50> name=None at 236be90> -> _value _value = _static_37142352 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_36787856 = _i18n_domain _i18n_domain = u'old' _backup_attrs_39848848 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b8d0> name=None at 236b150> -> _value _value = _static_37140688 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_37142224 = _i18n_domain _i18n_domain = u'new' _backup_attrs_40301704 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b650> name=None at 236b050> -> _value _value = _static_37140048 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _stream_37142416 = _DebuggingOutputStream() _append_37142416 = _stream_37142416.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_37142416(_content_139955154988272) _msgid_37142416 = re_whitespace(''.join(_stream_37142416)).strip() append(translate(_msgid_37142416, mapping=None, default=_msgid_37142416, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_40301704 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_40301704 _i18n_domain = _previous_i18n_domain_37142224 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39862784 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f290> name=None at 249f3d0> -> _value _value = _static_38400656 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _stream_38576208 = _DebuggingOutputStream() _append_38576208 = _stream_38576208.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_38576208(_content_139955154988272) _msgid_38576208 = re_whitespace(''.join(_stream_38576208)).strip() append(translate(_msgid_38576208, mapping=None, default=_msgid_38576208, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_39862784 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39862784 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_36789456 = _i18n_domain _i18n_domain = u'new' _backup_attrs_38619904 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f8d0> name=None at 249fe10> -> _value _value = _static_38402256 econtext['attrs'] = _value # <div ... (9:4) # -------------------------------------------------------- append(u'<div') _backup_default_38620624 = get('default', _marker) _value = u'test' econtext['default'] = _value # <Translate msgid=None node=<_ast.Str object at 0x249fc10> at 249f190> -> _attr_class _attr_class = u'test' _attr_class = translate(_attr_class, default=_attr_class, domain=_i18n_domain) if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_38620624 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38620624 append(u'>') _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_38619904 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38619904 _i18n_domain = _previous_i18n_domain_36789456 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_36786320 = _i18n_domain _i18n_domain = u'new' _backup_attrs_38620120 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315590> name=None at 23151d0> -> _value _value = _static_36787600 econtext['attrs'] = _value # <div ... (12:4) # -------------------------------------------------------- append(u'<div') _backup_default_38618464 = get('default', _marker) _value = u'test' econtext['default'] = _value # <Translate msgid=u'test_msgid' node=<_ast.Str object at 0x2315050> at 2315f10> -> _attr_class _attr_class = u'test' _attr_class = translate(u'test_msgid', default=_attr_class, domain=_i18n_domain) if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_38618464 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38618464 append(u'>') _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_38620120 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38620120 _i18n_domain = _previous_i18n_domain_36786320 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_39848848 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39848848 _i18n_domain = _previous_i18n_domain_36787856 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_39931128 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39931128 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/021-translation-domain.pt.py������������������������������0000600�0001750�0000144�00000024665�11547550677�026320� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import DebuggingOutputStream as _DebuggingOutputStream pass _static_37141584 = {u'class': u'test', } _static_38400080 = {} _static_36787472 = {} _static_36787536 = {} _static_37142224 = {u'class': u'test', } _static_38401744 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35899728 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f050> name=None at 249fdd0> -> _value _value = _static_38400080 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_37140368 = _i18n_domain _i18n_domain = u'old' _backup_attrs_35899296 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f6d0> name=None at 249f850> -> _value _value = _static_38401744 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_36787664 = _i18n_domain _i18n_domain = u'new' _backup_attrs_35899656 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315550> name=None at 2315d90> -> _value _value = _static_36787536 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _stream_36789456 = _DebuggingOutputStream() _append_36789456 = _stream_36789456.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_36789456(_content_139955154988272) _msgid_36789456 = re_whitespace(''.join(_stream_36789456)).strip() append(translate(_msgid_36789456, mapping=None, default=_msgid_36789456, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_35899656 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35899656 _i18n_domain = _previous_i18n_domain_36787664 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38614584 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315510> name=None at 23153d0> -> _value _value = _static_36787472 econtext['attrs'] = _value # <div ... (6:4) # -------------------------------------------------------- append(u'<div>') _stream_36787280 = _DebuggingOutputStream() _append_36787280 = _stream_36787280.append _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): _append_36787280(_content_139955154988272) _msgid_36787280 = re_whitespace(''.join(_stream_36787280)).strip() append(translate(_msgid_36787280, mapping=None, default=_msgid_36787280, domain=_i18n_domain)) append(u'</div>') if (_backup_attrs_38614584 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38614584 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_37139408 = _i18n_domain _i18n_domain = u'new' _backup_attrs_36648648 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bc50> name=None at 24ae750> -> _value _value = _static_37141584 econtext['attrs'] = _value # <div ... (9:4) # -------------------------------------------------------- append(u'<div') _backup_default_36650880 = get('default', _marker) _value = u'test' econtext['default'] = _value # <Translate msgid=None node=<_ast.Str object at 0x236bf50> at 236b210> -> _attr_class _attr_class = u'test' _attr_class = translate(_attr_class, default=_attr_class, domain=_i18n_domain) if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_36650880 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36650880 append(u'>') _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_36648648 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36648648 _i18n_domain = _previous_i18n_domain_37139408 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _previous_i18n_domain_37139344 = _i18n_domain _i18n_domain = u'new' _backup_attrs_39044808 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bed0> name=None at 236b4d0> -> _value _value = _static_37142224 econtext['attrs'] = _value # <div ... (12:4) # -------------------------------------------------------- append(u'<div') _backup_default_39044664 = get('default', _marker) _value = u'test' econtext['default'] = _value # <Translate msgid=u'test_msgid' node=<_ast.Str object at 0x236b650> at 236b7d0> -> _attr_class _attr_class = u'test' _attr_class = translate(u'test_msgid', default=_attr_class, domain=_i18n_domain) if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_39044664 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39044664 append(u'>') _content_139955154988272 = u'\n Hello world!\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_39044808 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39044808 _i18n_domain = _previous_i18n_domain_37139344 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35899296 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35899296 _i18n_domain = _previous_i18n_domain_37140368 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35899728 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35899728 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/021.xml���������������������������������������������������0000644�0001750�0000144�00000000116�11445675021�022222� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><!-- a comment --></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/022-switch.pt���������������������������������������������0000644�0001750�0000144�00000001066�12115344430�023342� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:switch="True"> <span tal:case="False">bad</span> <span tal:case="True">ok</span> <span tal:case="True">ok</span> <span tal:case="default">bad</span> <span tal:case="True">bad</span> ${default|string:ok} </div> <div tal:switch="True"> <span tal:case="False">bad</span> <span tal:case="default">ok</span> </div> <div tal:switch="3"> <span tal:case="1">bad</span> <span tal:case="2">bad</span> <span tal:case="default">ok</span> </div> </body> </html> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/022-switch.pt.py������������������������������������������0000600�0001750�0000144�00000026267�11547550677�024017� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_37142480 = {} _static_38891664 = {} _static_37142352 = {} _static_38894800 = {} _static_38893584 = {} _static_36788624 = {} _static_37141584 = {} _static_36789456 = {} _static_38400400 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39791864 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315cd0> name=None at 2315090> -> _value _value = _static_36789456 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39094824 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2315990> name=None at 2315f90> -> _value _value = _static_36788624 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'True' (3:21)> -> _cache_37139408 try: _cache_37139408 = True except: rcontext.setdefault('__error__', []).append((u'True', 3, 21, '<string>', _sys.exc_info()[1], )) raise _backup_attrs_38450528 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bc50> name=None at 236b150> -> _value _value = _static_37141584 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35792944 = get('default', _marker) _value = _cache_37139408 econtext['default'] = _value # <Equality expression=<Expression u'True' (3:21)> value=<Expression u'False' (4:22)> at 236bcd0> -> _condition _expression = _cache_37139408 # <Expression u'False' (4:22)> -> _value try: _value = False except: rcontext.setdefault('__error__', []).append((u'False', 4, 22, '<string>', _sys.exc_info()[1], )) raise _condition = (_expression == _value) if _condition: _backup_attrs_35791864 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bf50> name=None at 236b210> -> _value _value = _static_37142352 econtext['attrs'] = _value # <span ... (4:6) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'bad' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_35791864 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35791864 if (_backup_default_35792944 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35792944 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35794240 = get('default', _marker) _value = _cache_37139408 econtext['default'] = _value # <Equality expression=<Expression u'True' (3:21)> value=<Expression u'True' (5:22)> at 249f050> -> _condition _expression = _cache_37139408 # <Expression u'True' (5:22)> -> _value try: _value = True except: rcontext.setdefault('__error__', []).append((u'True', 5, 22, '<string>', _sys.exc_info()[1], )) raise _condition = (_expression == _value) if _condition: _backup_attrs_35794024 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bfd0> name=None at 236bb10> -> _value _value = _static_37142480 econtext['attrs'] = _value # <span ... (5:6) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'ok' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_35794024 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35794024 if (_backup_default_35794240 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35794240 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35792224 = get('default', _marker) _value = _cache_37139408 econtext['default'] = _value # <Equality expression=<Expression u'True' (3:21)> value=<Expression u'not not True' (6:22)> at 249fc50> -> _condition _expression = _cache_37139408 # <Expression u'not not True' (6:22)> -> _value try: _value = not not True except: rcontext.setdefault('__error__', []).append((u'not not True', 6, 22, '<string>', _sys.exc_info()[1], )) raise _condition = (_expression == _value) if _condition: _backup_attrs_35794312 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f190> name=None at 249f950> -> _value _value = _static_38400400 econtext['attrs'] = _value # <span ... (6:6) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'ok' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_35794312 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35794312 if (_backup_default_35792224 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35792224 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_38450528 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38450528 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'True' (8:21)> -> _cache_38892304 try: _cache_38892304 = True except: rcontext.setdefault('__error__', []).append((u'True', 8, 21, '<string>', _sys.exc_info()[1], )) raise _backup_attrs_39792936 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2517090> name=None at 2517150> -> _value _value = _static_38891664 econtext['attrs'] = _value # <div ... (8:4) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39865448 = get('default', _marker) _value = _cache_38892304 econtext['default'] = _value # <Equality expression=<Expression u'True' (8:21)> value=<Expression u'False' (9:22)> at 2517590> -> _condition _expression = _cache_38892304 # <Expression u'False' (9:22)> -> _value try: _value = False except: rcontext.setdefault('__error__', []).append((u'False', 9, 22, '<string>', _sys.exc_info()[1], )) raise _condition = (_expression == _value) if _condition: _backup_attrs_39863216 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2517810> name=None at 2517690> -> _value _value = _static_38893584 econtext['attrs'] = _value # <span ... (9:6) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'bad' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_39863216 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39863216 if (_backup_default_39865448 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39865448 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39804224 = get('default', _marker) _value = _cache_38892304 econtext['default'] = _value # <Equality expression=<Expression u'True' (8:21)> value=<Expression u'default' (10:22)> at 2517a50> -> _condition _expression = _cache_38892304 # <Expression u'default' (10:22)> -> _value try: _value = getitem('default') except: rcontext.setdefault('__error__', []).append((u'default', 10, 22, '<string>', _sys.exc_info()[1], )) raise _condition = (_expression == _value) if _condition: _backup_attrs_39865808 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2517cd0> name=None at 2517b90> -> _value _value = _static_38894800 econtext['attrs'] = _value # <span ... (10:6) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'ok' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_39865808 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39865808 if (_backup_default_39804224 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39804224 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_39792936 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39792936 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_39094824 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39094824 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_39791864 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39791864 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/022.xml���������������������������������������������������0000644�0001750�0000144�00000000120�11445675021�022216� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc><!-- a comment ->--></doc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/023-condition.pt������������������������������������������0000644�0001750�0000144�00000000252�11527750224�024034� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body tal:condition="True"> <span tal:define="selector False" tal:condition="selector">bad</span> <span tal:condition="True">ok</span> </body> </html> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/023-condition.pt.py���������������������������������������0000600�0001750�0000144�00000012022�11547550677�024465� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_37141392 = {} _static_38401104 = {} _static_38400656 = {} _static_37139024 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38619040 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f290> name=None at 249fc10> -> _value _value = _static_38400656 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'True' (2:23)> -> _condition try: _condition = True except: rcontext.setdefault('__error__', []).append((u'True', 2, 23, '<string>', _sys.exc_info()[1], )) raise if _condition: _backup_attrs_39065432 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f450> name=None at 249f850> -> _value _value = _static_38401104 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_selector_38402576 = get('selector', _marker) # <Expression u'False' (3:31)> -> _value try: _value = False except: rcontext.setdefault('__error__', []).append((u'False', 3, 31, '<string>', _sys.exc_info()[1], )) raise econtext['selector'] = _value # <Expression u'selector' (3:53)> -> _condition try: _condition = getitem('selector') except: rcontext.setdefault('__error__', []).append((u'selector', 3, 53, '<string>', _sys.exc_info()[1], )) raise if _condition: _backup_attrs_39065576 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b250> name=None at 236b450> -> _value _value = _static_37139024 econtext['attrs'] = _value # <span ... (3:4) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'bad' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_39065576 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39065576 if (_backup_selector_38402576 is _marker): del econtext['selector'] else: econtext['selector'] = _backup_selector_38402576 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'True' (4:25)> -> _condition try: _condition = True except: rcontext.setdefault('__error__', []).append((u'True', 4, 25, '<string>', _sys.exc_info()[1], )) raise if _condition: _backup_attrs_39064784 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236bb90> name=None at 236bbd0> -> _value _value = _static_37141392 econtext['attrs'] = _value # <span ... (4:4) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'ok' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_39064784 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39064784 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_39065432 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39065432 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_38619040 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38619040 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/023.xml���������������������������������������������������0000644�0001750�0000144�00000000117�11445675021�022225� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ENTITY e ""> ]> <doc>&e;</doc> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/024-namespace-elements.pt���������������������������������0000644�0001750�0000144�00000000402�11450103772�025605� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <tal:first> <tal:second> ${'first'} </tal:second> second </tal:first> <tal:block condition="True"> ok </tal:block> <tal:block condition="False"> bad </tal:block> </body> </html> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/024-namespace-elements.pt.py������������������������������0000600�0001750�0000144�00000013766�11547550677�026266� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_37140624 = {} _static_37139664 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_37108192 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b4d0> name=None at 236b510> -> _value _value = _static_37139664 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38451104 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b890> name=None at 236b8d0> -> _value _value = _static_37140624 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u"'first'" (5:10)> -> _content_139955154988272 try: _content_139955154988272 = 'first' except: rcontext.setdefault('__error__', []).append((u"'first'", 5, 10, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n second\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'True' (9:26)> -> _condition try: _condition = True except: rcontext.setdefault('__error__', []).append((u'True', 9, 26, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u'\n ok\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'False' (12:26)> -> _condition try: _condition = False except: rcontext.setdefault('__error__', []).append((u'False', 12, 26, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u'\n bad\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_38451104 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38451104 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_37108192 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37108192 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass����������Chameleon-2.24/src/chameleon/tests/inputs/024.xml���������������������������������������������������0000644�0001750�0000144�00000000164�11445675021�022230� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (foo)> <!ELEMENT foo (#PCDATA)> <!ENTITY e "<foo></foo>"> ]> <doc>&e;</doc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/025-repeat-whitespace.pt����������������������������������0000644�0001750�0000144�00000000751�12240706265�025465� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <ul> <li tal:repeat="i (1, 2, 3)" tal:content="i" /> <tal:item repeat="i (1, 2, 3)"><li tal:content="i" /></tal:item> <span tal:omit-tag="" tal:repeat="j (1, 2, 3)"><li tal:content="j" /></span> <tal:count> <tal:count-loop repeat="count (1, 2, 3)"> <span tal:replace="count" /><tal:comma condition="not repeat['count'].end">,</tal:comma> </tal:count-loop> </tal:count>. </ul> </body> </html> �����������������������Chameleon-2.24/src/chameleon/tests/inputs/025-repeat-whitespace.pt.py�������������������������������0000600�0001750�0000144�00000040410�11547550677�026115� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_39102032 = {} _static_39102544 = {} _static_37140880 = {} _static_39103376 = {} _static_37139664 = {} _static_37139600 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39095400 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b4d0> name=None at 236b310> -> _value _value = _static_37139664 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39815792 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b990> name=None at 236b890> -> _value _value = _static_37140880 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39828080 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b490> name=None at 236b390> -> _value _value = _static_37139600 econtext['attrs'] = _value # <ul ... (3:4) # -------------------------------------------------------- append(u'<ul>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_35883472 = get('i', _marker) # <Expression u'(1, 2, 3)' (4:26)> -> _iterator try: _iterator = (1, 2, 3, ) except: rcontext.setdefault('__error__', []).append((u'(1, 2, 3)', 4, 26, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_39101968, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_attrs_40288912 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a650> name=None at 254a190> -> _value _value = _static_39102032 econtext['attrs'] = _value # <li ... (4:37) # -------------------------------------------------------- append(u'<li>') _backup_default_39802640 = get('default', _marker) # <Marker name='default' at 254a510> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'i' (4:54)> -> _cache_39101904 try: _cache_39101904 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 4, 54, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'i' (4:54)> value=<Marker name='default' at 254a110> at 254a2d0> -> _condition _expression = _cache_39101904 # <Marker name='default' at 254a110> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_39101904 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39802640 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39802640 append(u'</li>') if (_backup_attrs_40288912 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_40288912 __index_39101968 -= 1 if (__index_39101968 > 0): append('\n ') if (_backup_i_35883472 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_35883472 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_j_37194704 = get('j', _marker) # <Expression u'(1, 2, 3)' (5:42)> -> _iterator try: _iterator = (1, 2, 3, ) except: rcontext.setdefault('__error__', []).append((u'(1, 2, 3)', 5, 42, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_39100944, ) = getitem('repeat')(u'j', _iterator) econtext['j'] = None for _item in _iterator: econtext['j'] = _item _backup_attrs_40302712 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254ab90> name=None at 254af90> -> _value _value = _static_39103376 econtext['attrs'] = _value # <li ... (5:53) # -------------------------------------------------------- append(u'<li>') _backup_default_40289920 = get('default', _marker) # <Marker name='default' at 254a890> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'j' (5:70)> -> _cache_39103632 try: _cache_39103632 = getitem('j') except: rcontext.setdefault('__error__', []).append((u'j', 5, 70, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'j' (5:70)> value=<Marker name='default' at 254aa90> at 254a390> -> _condition _expression = _cache_39103632 # <Marker name='default' at 254aa90> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_39103632 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_40289920 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_40289920 append(u'</li>') if (_backup_attrs_40302712 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_40302712 __index_39100944 -= 1 if (__index_39100944 > 0): append('\n ') if (_backup_j_37194704 is _marker): del econtext['j'] else: econtext['j'] = _backup_j_37194704 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_count_37019152 = get('count', _marker) # <Expression u'(1, 2, 3)' (7:38)> -> _iterator try: _iterator = (1, 2, 3, ) except: rcontext.setdefault('__error__', []).append((u'(1, 2, 3)', 7, 38, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_39104016, ) = getitem('repeat')(u'count', _iterator) econtext['count'] = None for _item in _iterator: econtext['count'] = _item _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39927960 = get('default', _marker) # <Marker name='default' at 251bf10> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'count' (8:29)> -> _cache_38911312 try: _cache_38911312 = getitem('count') except: rcontext.setdefault('__error__', []).append((u'count', 8, 29, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'count' (8:29)> value=<Marker name='default' at 251bc10> at 251bc90> -> _condition _expression = _cache_38911312 # <Marker name='default' at 251bc10> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39930912 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a850> name=None at 254ae90> -> _value _value = _static_39102544 econtext['attrs'] = _value # <span ... (8:10) # -------------------------------------------------------- append(u'<span\n />') if (_backup_attrs_39930912 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39930912 else: _content = _cache_38911312 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39927960 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39927960 # <Expression u"not repeat['count'].end" (9:40)> -> _condition try: _condition = not getitem('repeat')['count'].end except: rcontext.setdefault('__error__', []).append((u"not repeat['count'].end", 9, 40, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u',' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) __index_39104016 -= 1 if (__index_39104016 > 0): append('\n ') if (_backup_count_37019152 is _marker): del econtext['count'] else: econtext['count'] = _backup_count_37019152 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'.\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</ul>') if (_backup_attrs_39828080 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39828080 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_39815792 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39815792 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_39095400 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39095400 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/025.xml���������������������������������������������������0000644�0001750�0000144�00000000144�11445675021�022227� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (foo*)> <!ELEMENT foo (#PCDATA)> ]> <doc><foo/><foo></foo></doc> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/026-repeat-variable.pt������������������������������������0000644�0001750�0000144�00000001135�11533700040�025101� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<div xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal"> <ul> <li tal:attributes="class repeat['i'].even()+repeat['i'].odd()" name="${i}-${repeat.i.index}" tal:repeat="i range(3)"><span tal:replace="i" /></li> </ul> <ul> <li tal:attributes="class repeat['i'].even+repeat['i'].odd" tal:repeat="i range(3)"><span tal:replace="i" /></li> </ul> <ul> <li tal:repeat="i range(3)"><span tal:condition="repeat['i'].even" tal:replace="repeat['i'].even" /><span tal:condition="repeat['i'].odd" tal:replace="repeat['i'].odd" /></li> </ul> </div> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/026-repeat-variable.pt.py���������������������������������0000600�0001750�0000144�00000074574�11547550677�025571� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder from chameleon.py26 import lookup_attr as _lookup_attr import sys as _sys pass _static_38933456 = {} _static_39103952 = {u'class': u"repeat['i'].even+repeat['i'].odd", } _static_38935056 = {} _static_39102992 = {} _static_38908624 = {u'xmlns': u'http://www.w3.org/1999/xhtml', } _static_39102672 = {} _static_37140880 = {} _static_38936208 = {} _static_38934416 = {} _static_37140112 = {u'name': u'${i}-${repeat.i.index}', u'class': u"repeat['i'].even()+repeat['i'].odd()", } _static_38935312 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_38631760 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x251b2d0> name=None at 251b610> -> _value _value = _static_38908624 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div') _attr_xmlns = u'http://www.w3.org/1999/xhtml' if (_attr_xmlns is not None): append((u' xmlns="%s"' % _attr_xmlns)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39790784 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b990> name=None at 236b890> -> _value _value = _static_37140880 econtext['attrs'] = _value # <ul ... (3:2) # -------------------------------------------------------- append(u'<ul>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_35883472 = get('i', _marker) # <Expression u'range(3)' (4:112)> -> _iterator try: _iterator = get('range', range)(3) except: rcontext.setdefault('__error__', []).append((u'range(3)', 4, 112, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_39101072, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_attrs_35757664 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x236b690> name=None at 236b490> -> _value _value = _static_37140112 econtext['attrs'] = _value # <li ... (4:4) # -------------------------------------------------------- append(u'<li') _backup_default_35754928 = get('default', _marker) _value = u'${i}-${repeat.i.index}' econtext['default'] = _value # <Interpolation value=u'${i}-${repeat.i.index}' escape=True at 236b2d0> -> _attr_name # <Expression u'i' (4:76)> -> _attr_name try: _attr_name = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 4, 76, '<string>', _sys.exc_info()[1], )) raise # <Expression u'repeat.i.index' (4:81)> -> _attr_name_181 try: _attr_name_181 = _lookup_attr(getitem('repeat'), 'i').index except: rcontext.setdefault('__error__', []).append((u'repeat.i.index', 4, 81, '<string>', _sys.exc_info()[1], )) raise _attr_name = ('%s%s%s' % ((_attr_name if (_attr_name is not None) else ''), (u'-' if (u'-' is not None) else ''), (_attr_name_181 if (_attr_name_181 is not None) else ''), )) if (_attr_name is None): pass else: if (_attr_name is False): _attr_name = None else: _tt = type(_attr_name) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_name = unicode(_attr_name) else: try: if (_tt is str): _attr_name = decode(_attr_name) else: if (_tt is not unicode): try: _attr_name = _attr_name.__html__ except: _attr_name = convert(_attr_name) else: raise RuntimeError except RuntimeError: _attr_name = _attr_name() else: if ((_attr_name is not None) and (re_needs_escape(_attr_name) is not None)): if ('&' in _attr_name): if (';' in _attr_name): _attr_name = re_amp.sub('&', _attr_name) else: _attr_name = _attr_name.replace('&', '&') if ('<' in _attr_name): _attr_name = _attr_name.replace('<', '<') if ('>' in _attr_name): _attr_name = _attr_name.replace('>', '>') if (u'"' in _attr_name): _attr_name = _attr_name.replace(u'"', '"') if (_attr_name is not None): append((u' name="%s"' % _attr_name)) if (_backup_default_35754928 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35754928 _backup_default_35754064 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u"repeat['i'].even()+repeat['i'].odd()" (4:30)> -> _attr_class try: _attr_class = (getitem('repeat')['i'].even() + getitem('repeat')['i'].odd()) except: rcontext.setdefault('__error__', []).append((u"repeat['i'].even()+repeat['i'].odd()", 4, 30, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if ('"' in _attr_class): _attr_class = _attr_class.replace('"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_35754064 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35754064 append(u'>') _backup_default_35756584 = get('default', _marker) # <Marker name='default' at 254aed0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'i' (4:141)> -> _cache_39102928 try: _cache_39102928 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 4, 141, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'i' (4:141)> value=<Marker name='default' at 254ab90> at 254aa50> -> _condition _expression = _cache_39102928 # <Marker name='default' at 254ab90> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_35754712 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a8d0> name=None at 254a110> -> _value _value = _static_39102672 econtext['attrs'] = _value # <span ... (4:122) # -------------------------------------------------------- append(u'<span />') if (_backup_attrs_35754712 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35754712 else: _content = _cache_39102928 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35756584 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35756584 append(u'</li>') if (_backup_attrs_35757664 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35757664 __index_39101072 -= 1 if (__index_39101072 > 0): append('\n ') if (_backup_i_35883472 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_35883472 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</ul>') if (_backup_attrs_39790784 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39790784 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35754496 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254aa10> name=None at 254ac90> -> _value _value = _static_39102992 econtext['attrs'] = _value # <ul ... (6:2) # -------------------------------------------------------- append(u'<ul>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_40028112 = get('i', _marker) # <Expression u'range(3)' (8:22)> -> _iterator try: _iterator = get('range', range)(3) except: rcontext.setdefault('__error__', []).append((u'range(3)', 8, 22, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_38403088, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_attrs_35756368 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254add0> name=None at 254aad0> -> _value _value = _static_39103952 econtext['attrs'] = _value # <li ... (7:4) # -------------------------------------------------------- append(u'<li') _backup_default_35757088 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u"repeat['i'].even+repeat['i'].odd" (7:30)> -> _attr_class try: _attr_class = (getitem('repeat')['i'].even + getitem('repeat')['i'].odd) except: rcontext.setdefault('__error__', []).append((u"repeat['i'].even+repeat['i'].odd", 7, 30, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if ('"' in _attr_class): _attr_class = _attr_class.replace('"', '"') if (_attr_class is not None): append((u' class="%s"' % _attr_class)) if (_backup_default_35757088 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35757088 append(u'>') _backup_default_36681632 = get('default', _marker) # <Marker name='default' at 2521fd0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'i' (8:51)> -> _cache_38935952 try: _cache_38935952 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 8, 51, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'i' (8:51)> value=<Marker name='default' at 2521950> at 2521d10> -> _condition _expression = _cache_38935952 # <Marker name='default' at 2521950> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_36679832 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521e90> name=None at 249f050> -> _value _value = _static_38936208 econtext['attrs'] = _value # <span ... (8:32) # -------------------------------------------------------- append(u'<span />') if (_backup_attrs_36679832 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36679832 else: _content = _cache_38935952 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36681632 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36681632 append(u'</li>') if (_backup_attrs_35756368 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35756368 __index_38403088 -= 1 if (__index_38403088 > 0): append('\n ') if (_backup_i_40028112 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_40028112 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</ul>') if (_backup_attrs_35754496 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35754496 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36680552 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521b10> name=None at 2521f90> -> _value _value = _static_38935312 econtext['attrs'] = _value # <ul ... (10:2) # -------------------------------------------------------- append(u'<ul>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_35203664 = get('i', _marker) # <Expression u'range(3)' (11:22)> -> _iterator try: _iterator = get('range', range)(3) except: rcontext.setdefault('__error__', []).append((u'range(3)', 11, 22, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_38934352, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_attrs_36746592 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521a10> name=None at 2521550> -> _value _value = _static_38935056 econtext['attrs'] = _value # <li ... (11:4) # -------------------------------------------------------- append(u'<li>') # <Expression u"repeat['i'].even" (11:53)> -> _condition try: _condition = getitem('repeat')['i'].even except: rcontext.setdefault('__error__', []).append((u"repeat['i'].even", 11, 53, '<string>', _sys.exc_info()[1], )) raise if _condition: _backup_default_39092096 = get('default', _marker) # <Marker name='default' at 2521150> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"repeat['i'].even" (11:84)> -> _cache_38932752 try: _cache_38932752 = getitem('repeat')['i'].even except: rcontext.setdefault('__error__', []).append((u"repeat['i'].even", 11, 84, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"repeat['i'].even" (11:84)> value=<Marker name='default' at 2521390> at 25214d0> -> _condition _expression = _cache_38932752 # <Marker name='default' at 2521390> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39088424 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521790> name=None at 25217d0> -> _value _value = _static_38934416 econtext['attrs'] = _value # <span ... (11:32) # -------------------------------------------------------- append(u'<span />') if (_backup_attrs_39088424 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39088424 else: _content = _cache_38932752 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39092096 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39092096 # <Expression u"repeat['i'].odd" (11:125)> -> _condition try: _condition = getitem('repeat')['i'].odd except: rcontext.setdefault('__error__', []).append((u"repeat['i'].odd", 11, 125, '<string>', _sys.exc_info()[1], )) raise if _condition: _backup_default_39089000 = get('default', _marker) # <Marker name='default' at 262c590> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"repeat['i'].odd" (11:155)> -> _cache_38936400 try: _cache_38936400 = getitem('repeat')['i'].odd except: rcontext.setdefault('__error__', []).append((u"repeat['i'].odd", 11, 155, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"repeat['i'].odd" (11:155)> value=<Marker name='default' at 262c0d0> at 262c850> -> _condition _expression = _cache_38936400 # <Marker name='default' at 262c0d0> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_39091592 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x25213d0> name=None at 2521050> -> _value _value = _static_38933456 econtext['attrs'] = _value # <span ... (11:104) # -------------------------------------------------------- append(u'<span />') if (_backup_attrs_39091592 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39091592 else: _content = _cache_38936400 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39089000 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39089000 append(u'</li>') if (_backup_attrs_36746592 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36746592 __index_38934352 -= 1 if (__index_38934352 > 0): append('\n ') if (_backup_i_35203664 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_35203664 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</ul>') if (_backup_attrs_36680552 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36680552 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_38631760 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38631760 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/026.xml���������������������������������������������������0000644�0001750�0000144�00000000140�11445675021�022224� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (foo*)> <!ELEMENT foo EMPTY> ]> <doc><foo/><foo></foo></doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/027-attribute-replacement.pt������������������������������0000644�0001750�0000144�00000000674�11631410073�026351� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<div xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal"> <span id="test" class="dummy" onClick="" tal:define="a 'abc'" tal:attributes="class 'def' + a + default; style 'hij'; onClick 'alert();;'" tal:content="a + 'ghi'" /> <span tal:replace="'Hello World!'">Hello <b>Universe</b>!</span> <span tal:replace="'Hello World!'"><b>Hello Universe!</b></span> </div> ��������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/027-attribute-replacement.pt.py���������������������������0000600�0001750�0000144�00000050233�11547550677�027011� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_38936400 = {} _static_38932624 = {} _static_39101904 = {u'xmlns': u'http://www.w3.org/1999/xhtml', } _static_39103376 = {u'style': u"'hij'", u'id': u'test', u'onClick': u'', u'class': u'dummy', } _static_38935952 = {} _static_38934352 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39046104 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a5d0> name=None at 249f050> -> _value _value = _static_39101904 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div') _attr_xmlns = u'http://www.w3.org/1999/xhtml' if (_attr_xmlns is not None): append((u' xmlns="%s"' % _attr_xmlns)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_a_35883472 = get('a', _marker) # <Expression u"'abc'" (6:22)> -> _value try: _value = 'abc' except: rcontext.setdefault('__error__', []).append((u"'abc'", 6, 22, '<string>', _sys.exc_info()[1], )) raise econtext['a'] = _value _backup_attrs_38523464 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254ab90> name=None at 254aa50> -> _value _value = _static_39103376 econtext['attrs'] = _value # <span ... (3:2) # -------------------------------------------------------- append(u'<span') _attr_id = u'test' if (_attr_id is not None): append((u' id="%s"' % _attr_id)) _backup_default_39046968 = get('default', _marker) _value = u'dummy' econtext['default'] = _value # <Expression u"'def' + a + default" (7:30)> -> _attr_class try: _attr_class = (('def' + getitem('a')) + getitem('default')) except: rcontext.setdefault('__error__', []).append((u"'def' + a + default", 7, 30, '<string>', _sys.exc_info()[1], )) raise if (_attr_class is None): pass else: if (_attr_class is False): _attr_class = None else: _tt = type(_attr_class) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_class = unicode(_attr_class) else: try: if (_tt is str): _attr_class = decode(_attr_class) else: if (_tt is not unicode): try: _attr_class = _attr_class.__html__ except: _attr_class = convert(_attr_class) else: raise RuntimeError except RuntimeError: _attr_class = _attr_class() else: if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)): if ('&' in _attr_class): if (';' in _attr_class): _attr_class = re_amp.sub('&', _attr_class) else: _attr_class = _attr_class.replace('&', '&') if ('<' in _attr_class): _attr_class = _attr_class.replace('<', '<') if ('>' in _attr_class): _attr_class = _attr_class.replace('>', '>') if (u'"' in _attr_class): _attr_class = _attr_class.replace(u'"', '"') if (_attr_class is not None): append((u'\n class="%s"' % _attr_class)) if (_backup_default_39046968 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39046968 _backup_default_38526416 = get('default', _marker) _value = u'' econtext['default'] = _value # <Expression u"'alert();'" (7:70)> -> _attr_onClick try: _attr_onClick = 'alert();' except: rcontext.setdefault('__error__', []).append((u"'alert();'", 7, 70, '<string>', _sys.exc_info()[1], )) raise if (_attr_onClick is None): pass else: if (_attr_onClick is False): _attr_onClick = None else: _tt = type(_attr_onClick) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_onClick = unicode(_attr_onClick) else: try: if (_tt is str): _attr_onClick = decode(_attr_onClick) else: if (_tt is not unicode): try: _attr_onClick = _attr_onClick.__html__ except: _attr_onClick = convert(_attr_onClick) else: raise RuntimeError except RuntimeError: _attr_onClick = _attr_onClick() else: if ((_attr_onClick is not None) and (re_needs_escape(_attr_onClick) is not None)): if ('&' in _attr_onClick): if (';' in _attr_onClick): _attr_onClick = re_amp.sub('&', _attr_onClick) else: _attr_onClick = _attr_onClick.replace('&', '&') if ('<' in _attr_onClick): _attr_onClick = _attr_onClick.replace('<', '<') if ('>' in _attr_onClick): _attr_onClick = _attr_onClick.replace('>', '>') if (u'"' in _attr_onClick): _attr_onClick = _attr_onClick.replace(u'"', '"') if (_attr_onClick is not None): append((u'\n onClick="%s"' % _attr_onClick)) if (_backup_default_38526416 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38526416 _backup_default_38524760 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u"'hij'" (7:56)> -> _attr_style try: _attr_style = 'hij' except: rcontext.setdefault('__error__', []).append((u"'hij'", 7, 56, '<string>', _sys.exc_info()[1], )) raise if (_attr_style is None): pass else: if (_attr_style is False): _attr_style = None else: _tt = type(_attr_style) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_style = unicode(_attr_style) else: try: if (_tt is str): _attr_style = decode(_attr_style) else: if (_tt is not unicode): try: _attr_style = _attr_style.__html__ except: _attr_style = convert(_attr_style) else: raise RuntimeError except RuntimeError: _attr_style = _attr_style() else: if ((_attr_style is not None) and (re_needs_escape(_attr_style) is not None)): if ('&' in _attr_style): if (';' in _attr_style): _attr_style = re_amp.sub('&', _attr_style) else: _attr_style = _attr_style.replace('&', '&') if ('<' in _attr_style): _attr_style = _attr_style.replace('<', '<') if ('>' in _attr_style): _attr_style = _attr_style.replace('>', '>') if ('"' in _attr_style): _attr_style = _attr_style.replace('"', '"') if (_attr_style is not None): append((u' style="%s"' % _attr_style)) if (_backup_default_38524760 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38524760 append('>') _backup_default_38525480 = get('default', _marker) # <Marker name='default' at 254a9d0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"a + 'ghi'" (8:21)> -> _cache_39100816 try: _cache_39100816 = (getitem('a') + 'ghi') except: rcontext.setdefault('__error__', []).append((u"a + 'ghi'", 8, 21, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"a + 'ghi'" (8:21)> value=<Marker name='default' at 254a890> at 254a090> -> _condition _expression = _cache_39100816 # <Marker name='default' at 254a890> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_39100816 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38525480 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38525480 append(u'</span>') if (_backup_attrs_38523464 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38523464 if (_backup_a_35883472 is _marker): del econtext['a'] else: econtext['a'] = _backup_a_35883472 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_39596544 = get('default', _marker) # <Marker name='default' at 2521f90> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello World!'" (9:21)> -> _cache_38934928 try: _cache_38934928 = 'Hello World!' except: rcontext.setdefault('__error__', []).append((u"'Hello World!'", 9, 21, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello World!'" (9:21)> value=<Marker name='default' at 2521c50> at 2521b50> -> _condition _expression = _cache_38934928 # <Marker name='default' at 2521c50> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_38526488 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521d90> name=None at 2521e10> -> _value _value = _static_38935952 econtext['attrs'] = _value # <span ... (9:2) # -------------------------------------------------------- append(u'<span>') _content_139955154988272 = u'Hello ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36682352 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521750> name=None at 2521ed0> -> _value _value = _static_38934352 econtext['attrs'] = _value # <b ... (9:43) # -------------------------------------------------------- append(u'<b>') _content_139955154988272 = u'Universe' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</b>') if (_backup_attrs_36682352 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36682352 _content_139955154988272 = u'!' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</span>') if (_backup_attrs_38526488 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38526488 else: _content = _cache_38934928 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_39596544 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39596544 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_36682856 = get('default', _marker) # <Marker name='default' at 2521710> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello World!'" (10:21)> -> _cache_38932752 try: _cache_38932752 = 'Hello World!' except: rcontext.setdefault('__error__', []).append((u"'Hello World!'", 10, 21, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello World!'" (10:21)> value=<Marker name='default' at 2521410> at 25214d0> -> _condition _expression = _cache_38932752 # <Marker name='default' at 2521410> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _backup_attrs_36682928 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521090> name=None at 25215d0> -> _value _value = _static_38932624 econtext['attrs'] = _value # <span ... (10:2) # -------------------------------------------------------- append(u'<span>') _backup_attrs_35804656 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521f50> name=None at 2521490> -> _value _value = _static_38936400 econtext['attrs'] = _value # <b ... (10:37) # -------------------------------------------------------- append(u'<b>') _content_139955154988272 = u'Hello Universe!' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</b>') if (_backup_attrs_35804656 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35804656 append(u'</span>') if (_backup_attrs_36682928 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36682928 else: _content = _cache_38932752 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36682856 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36682856 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_39046104 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39046104 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/027.xml���������������������������������������������������0000644�0001750�0000144�00000000136�11445675021�022232� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (foo*)> <!ELEMENT foo ANY> ]> <doc><foo/><foo></foo></doc> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/028-attribute-toggle.pt�����������������������������������0000644�0001750�0000144�00000000400�11623427755�025337� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<div xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal"> <option tal:attributes="selected True"></option> <option tal:attributes="selected False"></option> <option tal:attributes="selected None"></option> </div> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/028-attribute-toggle.pt.py��������������������������������0000600�0001750�0000144�00000031712�11547550677�025775� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_39101904 = {u'checked': u'True', } _static_39101136 = {u'checked': u'False', } _static_38932624 = {u'selected': u'None', } _static_38934992 = {u'selected': u'True', } _static_38934864 = {u'xmlns': u'http://www.w3.org/1999/xhtml', } import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_39545024 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521950> name=None at 2521e90> -> _value _value = _static_38934864 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div') _attr_xmlns = u'http://www.w3.org/1999/xhtml' if (_attr_xmlns is not None): append((u' xmlns="%s"' % _attr_xmlns)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39545672 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x25219d0> name=None at 2521610> -> _value _value = _static_38934992 econtext['attrs'] = _value # <option ... (3:2) # -------------------------------------------------------- append(u'<option') _backup_default_39545096 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u'True' (3:35)> -> _attr_selected try: _attr_selected = True except: rcontext.setdefault('__error__', []).append((u'True', 3, 35, '<string>', _sys.exc_info()[1], )) raise if (_attr_selected is None): pass else: if (_attr_selected is False): _attr_selected = None else: _tt = type(_attr_selected) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_selected = unicode(_attr_selected) else: try: if (_tt is str): _attr_selected = decode(_attr_selected) else: if (_tt is not unicode): try: _attr_selected = _attr_selected.__html__ except: _attr_selected = convert(_attr_selected) else: raise RuntimeError except RuntimeError: _attr_selected = _attr_selected() else: if ((_attr_selected is not None) and (re_needs_escape(_attr_selected) is not None)): if ('&' in _attr_selected): if (';' in _attr_selected): _attr_selected = re_amp.sub('&', _attr_selected) else: _attr_selected = _attr_selected.replace('&', '&') if ('<' in _attr_selected): _attr_selected = _attr_selected.replace('<', '<') if ('>' in _attr_selected): _attr_selected = _attr_selected.replace('>', '>') if ('"' in _attr_selected): _attr_selected = _attr_selected.replace('"', '"') if (_attr_selected is not None): append((u' selected="%s"' % _attr_selected)) if (_backup_default_39545096 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39545096 append(u'>') append(u'</option>') if (_backup_attrs_39545672 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39545672 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39594032 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2521090> name=None at 25215d0> -> _value _value = _static_38932624 econtext['attrs'] = _value # <option ... (4:2) # -------------------------------------------------------- append(u'<option') _backup_default_39594608 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u'None' (4:35)> -> _attr_selected try: _attr_selected = None except: rcontext.setdefault('__error__', []).append((u'None', 4, 35, '<string>', _sys.exc_info()[1], )) raise if (_attr_selected is None): pass else: if (_attr_selected is False): _attr_selected = None else: _tt = type(_attr_selected) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_selected = unicode(_attr_selected) else: try: if (_tt is str): _attr_selected = decode(_attr_selected) else: if (_tt is not unicode): try: _attr_selected = _attr_selected.__html__ except: _attr_selected = convert(_attr_selected) else: raise RuntimeError except RuntimeError: _attr_selected = _attr_selected() else: if ((_attr_selected is not None) and (re_needs_escape(_attr_selected) is not None)): if ('&' in _attr_selected): if (';' in _attr_selected): _attr_selected = re_amp.sub('&', _attr_selected) else: _attr_selected = _attr_selected.replace('&', '&') if ('<' in _attr_selected): _attr_selected = _attr_selected.replace('<', '<') if ('>' in _attr_selected): _attr_selected = _attr_selected.replace('>', '>') if ('"' in _attr_selected): _attr_selected = _attr_selected.replace('"', '"') if (_attr_selected is not None): append((u' selected="%s"' % _attr_selected)) if (_backup_default_39594608 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39594608 append(u'>') append(u'</option>') if (_backup_attrs_39594032 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39594032 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39595400 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a5d0> name=None at 254a750> -> _value _value = _static_39101904 econtext['attrs'] = _value # <input ... (5:2) # -------------------------------------------------------- append(u'<input') _backup_default_40174800 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u'True' (5:33)> -> _attr_checked try: _attr_checked = True except: rcontext.setdefault('__error__', []).append((u'True', 5, 33, '<string>', _sys.exc_info()[1], )) raise if (_attr_checked is None): pass else: if (_attr_checked is False): _attr_checked = None else: _tt = type(_attr_checked) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_checked = unicode(_attr_checked) else: try: if (_tt is str): _attr_checked = decode(_attr_checked) else: if (_tt is not unicode): try: _attr_checked = _attr_checked.__html__ except: _attr_checked = convert(_attr_checked) else: raise RuntimeError except RuntimeError: _attr_checked = _attr_checked() else: if ((_attr_checked is not None) and (re_needs_escape(_attr_checked) is not None)): if ('&' in _attr_checked): if (';' in _attr_checked): _attr_checked = re_amp.sub('&', _attr_checked) else: _attr_checked = _attr_checked.replace('&', '&') if ('<' in _attr_checked): _attr_checked = _attr_checked.replace('<', '<') if ('>' in _attr_checked): _attr_checked = _attr_checked.replace('>', '>') if ('"' in _attr_checked): _attr_checked = _attr_checked.replace('"', '"') if (_attr_checked is not None): append((u' checked="%s"' % _attr_checked)) if (_backup_default_40174800 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_40174800 append(u' />') if (_backup_attrs_39595400 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39595400 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_39593744 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a2d0> name=None at 254a210> -> _value _value = _static_39101136 econtext['attrs'] = _value # <input ... (6:2) # -------------------------------------------------------- append(u'<input') _backup_default_39066584 = get('default', _marker) _value = None econtext['default'] = _value # <Expression u'False' (6:33)> -> _attr_checked try: _attr_checked = False except: rcontext.setdefault('__error__', []).append((u'False', 6, 33, '<string>', _sys.exc_info()[1], )) raise if (_attr_checked is None): pass else: if (_attr_checked is False): _attr_checked = None else: _tt = type(_attr_checked) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_checked = unicode(_attr_checked) else: try: if (_tt is str): _attr_checked = decode(_attr_checked) else: if (_tt is not unicode): try: _attr_checked = _attr_checked.__html__ except: _attr_checked = convert(_attr_checked) else: raise RuntimeError except RuntimeError: _attr_checked = _attr_checked() else: if ((_attr_checked is not None) and (re_needs_escape(_attr_checked) is not None)): if ('&' in _attr_checked): if (';' in _attr_checked): _attr_checked = re_amp.sub('&', _attr_checked) else: _attr_checked = _attr_checked.replace('&', '&') if ('<' in _attr_checked): _attr_checked = _attr_checked.replace('<', '<') if ('>' in _attr_checked): _attr_checked = _attr_checked.replace('>', '>') if ('"' in _attr_checked): _attr_checked = _attr_checked.replace('"', '"') if (_attr_checked is not None): append((u' checked="%s"' % _attr_checked)) if (_backup_default_39066584 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_39066584 append(u' />') if (_backup_attrs_39593744 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39593744 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_39545024 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39545024 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/028.xml���������������������������������������������������0000644�0001750�0000144�00000000123�11445675021�022227� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc></doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/029-attribute-ordering.pt���������������������������������0000644�0001750�0000144�00000000316�11450375624�025671� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<div xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal"> <a rel="self" href="http://repoze.org" id="link-id" tal:attributes="href 'http://python.org'" /> </div> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/029-attribute-ordering.pt.py������������������������������0000600�0001750�0000144�00000010772�11547550677�026331� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_39103696 = {u'href': u'http://repoze.org', u'id': u'link-id', u'rel': u'self', } _static_39100880 = {u'xmlns': u'http://www.w3.org/1999/xhtml', } import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_37098488 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254a1d0> name=None at 254a7d0> -> _value _value = _static_39100880 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div') _attr_xmlns = u'http://www.w3.org/1999/xhtml' if (_attr_xmlns is not None): append((u' xmlns="%s"' % _attr_xmlns)) append(u'>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36810832 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x254acd0> name=None at 254ab10> -> _value _value = _static_39103696 econtext['attrs'] = _value # <a ... (3:2) # -------------------------------------------------------- append(u'<a') _attr_rel = u'self' if (_attr_rel is not None): append((u' rel="%s"' % _attr_rel)) _backup_default_36710736 = get('default', _marker) _value = u'http://repoze.org' econtext['default'] = _value # <Expression u"'http://python.org'" (4:26)> -> _attr_href try: _attr_href = 'http://python.org' except: rcontext.setdefault('__error__', []).append((u"'http://python.org'", 4, 26, '<string>', _sys.exc_info()[1], )) raise if (_attr_href is None): pass else: if (_attr_href is False): _attr_href = None else: _tt = type(_attr_href) if ((_tt is int) or (_tt is float) or (_tt is long)): _attr_href = unicode(_attr_href) else: try: if (_tt is str): _attr_href = decode(_attr_href) else: if (_tt is not unicode): try: _attr_href = _attr_href.__html__ except: _attr_href = convert(_attr_href) else: raise RuntimeError except RuntimeError: _attr_href = _attr_href() else: if ((_attr_href is not None) and (re_needs_escape(_attr_href) is not None)): if ('&' in _attr_href): if (';' in _attr_href): _attr_href = re_amp.sub('&', _attr_href) else: _attr_href = _attr_href.replace('&', '&') if ('<' in _attr_href): _attr_href = _attr_href.replace('<', '<') if ('>' in _attr_href): _attr_href = _attr_href.replace('>', '>') if (u'"' in _attr_href): _attr_href = _attr_href.replace(u'"', '"') if (_attr_href is not None): append((u' href="%s"' % _attr_href)) if (_backup_default_36710736 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36710736 _attr_id = u'link-id' if (_attr_id is not None): append((u' id="%s"' % _attr_id)) append(u' />') if (_backup_attrs_36810832 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36810832 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_37098488 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_37098488 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass������Chameleon-2.24/src/chameleon/tests/inputs/029.xml���������������������������������������������������0000644�0001750�0000144�00000000123�11445675021�022230� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version='1.0'?> <!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc></doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/030-repeat-tuples.pt��������������������������������������0000644�0001750�0000144�00000000211�11450404343�024622� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <div tal:repeat="(i, j) ((1, 2), (3, 4))"> ${repeat['i', 'j'].number}, ${i}, ${j} </div> </body> </html> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/030-repeat-tuples.pt.py�����������������������������������0000600�0001750�0000144�00000027206�11547550677�025301� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass import sys as _sys pass _static_38403088 = {} _static_36668752 = {} _static_40208144 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35947656 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x22f8550> name=None at 230a350> -> _value _value = _static_36668752 econtext['attrs'] = _value # <html ... (1:0) # -------------------------------------------------------- append(u'<html>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_35343464 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249fc10> name=None at 249fa90> -> _value _value = _static_38403088 econtext['attrs'] = _value # <body ... (2:2) # -------------------------------------------------------- append(u'<body>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_35341160 = get('i', _marker) _backup_j_35341160 = get('j', _marker) # <Expression u'((1, 2), (3, 4))' (3:28)> -> _iterator try: _iterator = ((1, 2, ), (3, 4, ), ) except: rcontext.setdefault('__error__', []).append((u'((1, 2), (3, 4))', 3, 28, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_40209040, ) = getitem('repeat')((u'i', u'j', ), _iterator) econtext['i'] = econtext['j'] = None for _item in _iterator: (econtext['i'], econtext['j'], ) = _item _backup_attrs_35343248 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x2658710> name=None at 2658750> -> _value _value = _static_40208144 econtext['attrs'] = _value # <div ... (3:4) # -------------------------------------------------------- append(u'<div>') # <Expression u"repeat['i', 'j'].number" (4:8)> -> _content_139955154988272 try: _content_139955154988272 = getitem('repeat')[('i', 'j', )].number except: rcontext.setdefault('__error__', []).append((u"repeat['i', 'j'].number", 4, 8, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') # <Expression u'i' (4:36)> -> _content_139955154988272_97 try: _content_139955154988272_97 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 4, 36, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_97 is None): pass else: if (_content_139955154988272_97 is False): _content_139955154988272_97 = None else: _tt = type(_content_139955154988272_97) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_97 = unicode(_content_139955154988272_97) else: try: if (_tt is str): _content_139955154988272_97 = decode(_content_139955154988272_97) else: if (_tt is not unicode): try: _content_139955154988272_97 = _content_139955154988272_97.__html__ except: _content_139955154988272_97 = convert(_content_139955154988272_97) else: raise RuntimeError except RuntimeError: _content_139955154988272_97 = _content_139955154988272_97() else: if ((_content_139955154988272_97 is not None) and (re_needs_escape(_content_139955154988272_97) is not None)): if ('&' in _content_139955154988272_97): if (';' in _content_139955154988272_97): _content_139955154988272_97 = re_amp.sub('&', _content_139955154988272_97) else: _content_139955154988272_97 = _content_139955154988272_97.replace('&', '&') if ('<' in _content_139955154988272_97): _content_139955154988272_97 = _content_139955154988272_97.replace('<', '<') if ('>' in _content_139955154988272_97): _content_139955154988272_97 = _content_139955154988272_97.replace('>', '>') if ('\x00' in _content_139955154988272_97): _content_139955154988272_97 = _content_139955154988272_97.replace('\x00', '"') # <Expression u'j' (4:42)> -> _content_139955154988272_103 try: _content_139955154988272_103 = getitem('j') except: rcontext.setdefault('__error__', []).append((u'j', 4, 42, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272_103 is None): pass else: if (_content_139955154988272_103 is False): _content_139955154988272_103 = None else: _tt = type(_content_139955154988272_103) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272_103 = unicode(_content_139955154988272_103) else: try: if (_tt is str): _content_139955154988272_103 = decode(_content_139955154988272_103) else: if (_tt is not unicode): try: _content_139955154988272_103 = _content_139955154988272_103.__html__ except: _content_139955154988272_103 = convert(_content_139955154988272_103) else: raise RuntimeError except RuntimeError: _content_139955154988272_103 = _content_139955154988272_103() else: if ((_content_139955154988272_103 is not None) and (re_needs_escape(_content_139955154988272_103) is not None)): if ('&' in _content_139955154988272_103): if (';' in _content_139955154988272_103): _content_139955154988272_103 = re_amp.sub('&', _content_139955154988272_103) else: _content_139955154988272_103 = _content_139955154988272_103.replace('&', '&') if ('<' in _content_139955154988272_103): _content_139955154988272_103 = _content_139955154988272_103.replace('<', '<') if ('>' in _content_139955154988272_103): _content_139955154988272_103 = _content_139955154988272_103.replace('>', '>') if ('\x00' in _content_139955154988272_103): _content_139955154988272_103 = _content_139955154988272_103.replace('\x00', '"') _content_139955154988272 = ('%s%s%s%s%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u', ' if (u', ' is not None) else ''), (_content_139955154988272_97 if (_content_139955154988272_97 is not None) else ''), (u', ' if (u', ' is not None) else ''), (_content_139955154988272_103 if (_content_139955154988272_103 is not None) else ''), (u'\n ' if (u'\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_35343248 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35343248 __index_40209040 -= 1 if (__index_40209040 > 0): append('\n ') if (_backup_i_35341160 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_35341160 if (_backup_j_35341160 is _marker): del econtext['j'] else: econtext['j'] = _backup_j_35341160 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</body>') if (_backup_attrs_35343464 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35343464 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</html>') if (_backup_attrs_35947656 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35947656 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/030.xml���������������������������������������������������0000644�0001750�0000144�00000000125�11445675021�022222� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version = "1.0"?> <!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc></doc> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/031-namespace-with-tal.pt���������������������������������0000644�0001750�0000144�00000000354�11450407017�025525� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<div> <tal:example replace="'Hello World!'" /> <tal:example tal:replace="'Hello World!'" /> <tal:div content="'Hello World!'" /> <tal:multiple repeat="i range(3)" replace="i" /> <tal:div condition="True">True</tal:div> </div> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/031-namespace-with-tal.pt.py������������������������������0000600�0001750�0000144�00000033435�11547550677�026174� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_38401872 = {} _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_attrs_35793880 = get('attrs', _marker) # <Static value=<_ast.Dict object at 0x249f750> name=None at 249f810> -> _value _value = _static_38401872 econtext['attrs'] = _value # <div ... (1:0) # -------------------------------------------------------- append(u'<div>') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_40161008 = get('default', _marker) # <Marker name='default' at 2658ad0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello World!'" (2:24)> -> _cache_40208016 try: _cache_40208016 = 'Hello World!' except: rcontext.setdefault('__error__', []).append((u"'Hello World!'", 2, 24, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello World!'" (2:24)> value=<Marker name='default' at 2658710> at 2658990> -> _condition _expression = _cache_40208016 # <Marker name='default' at 2658710> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_40208016 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_40161008 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_40161008 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35794744 = get('default', _marker) # <Marker name='default' at 2521610> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello World!'" (3:28)> -> _cache_36787408 try: _cache_36787408 = 'Hello World!' except: rcontext.setdefault('__error__', []).append((u"'Hello World!'", 3, 28, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello World!'" (3:28)> value=<Marker name='default' at 2521f90> at 2521cd0> -> _condition _expression = _cache_36787408 # <Marker name='default' at 2521f90> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_36787408 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35794744 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35794744 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_default_35792944 = get('default', _marker) # <Marker name='default' at 25219d0> -> _value _value = _marker_default econtext['default'] = _value # <Expression u"'Hello World!'" (4:20)> -> _cache_40209232 try: _cache_40209232 = 'Hello World!' except: rcontext.setdefault('__error__', []).append((u"'Hello World!'", 4, 20, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u"'Hello World!'" (4:20)> value=<Marker name='default' at 2521810> at 2521910> -> _condition _expression = _cache_40209232 # <Marker name='default' at 2521810> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_40209232 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_35792944 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_35792944 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_i_40210256 = get('i', _marker) # <Expression u'range(3)' (5:26)> -> _iterator try: _iterator = get('range', range)(3) except: rcontext.setdefault('__error__', []).append((u'range(3)', 5, 26, '<string>', _sys.exc_info()[1], )) raise (_iterator, __index_38934736, ) = getitem('repeat')(u'i', _iterator) econtext['i'] = None for _item in _iterator: econtext['i'] = _item _backup_default_40162008 = get('default', _marker) # <Marker name='default' at 2521f50> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'i' (5:45)> -> _cache_38932816 try: _cache_38932816 = getitem('i') except: rcontext.setdefault('__error__', []).append((u'i', 5, 45, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'i' (5:45)> value=<Marker name='default' at 2521050> at 25213d0> -> _condition _expression = _cache_38932816 # <Marker name='default' at 2521050> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: pass else: _content = _cache_38932816 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_40162008 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_40162008 __index_38934736 -= 1 if (__index_38934736 > 0): append('\n ') if (_backup_i_40210256 is _marker): del econtext['i'] else: econtext['i'] = _backup_i_40210256 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) # <Expression u'True' (6:22)> -> _condition try: _condition = True except: rcontext.setdefault('__error__', []).append((u'True', 6, 22, '<string>', _sys.exc_info()[1], )) raise if _condition: _content_139955154988272 = u'True' if (_content_139955154988272 is not None): append(_content_139955154988272) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'</div>') if (_backup_attrs_35793880 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_35793880 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) pass�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/031.xml���������������������������������������������������0000644�0001750�0000144�00000000144�11445675021�022224� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version='1.0' encoding="UTF-8"?> <!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc></doc> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/032-master-template.pt������������������������������������0000644�0001750�0000144�00000001151�11700567043�025147� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html i18n:domain="master" metal:define-macro="main" tal:define="content nothing"> <head> <title metal:define-slot="title" metal:define-macro="title" tal:define="has_title exists: title" tal:content="title if has_title else default">Master template
Chameleon-2.24/src/chameleon/tests/inputs/032-master-template.pt.py0000600000175000001440000003434311547550677025615 0ustar mborchusers00000000000000# -*- coding: utf-8 -*- pass from chameleon.utils import Placeholder as _Placeholder import sys as _sys pass _static_39973456 = {u'id': u'content', } _static_38402704 = {} _static_40208784 = {} _static_38935504 = {} _static_38935440 = {} _static_39975056 = {u'id': u'footer', } _marker_default = _Placeholder() import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render_main(stream, econtext, rcontext): try: _slot_title = getitem(u'_slot_title').pop() except: _slot_title = None try: _slot_content = getitem(u'_slot_content').pop() except: _slot_content = None try: _slot_body_footer = getitem(u'_slot_body_footer').pop() except: _slot_body_footer = None append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') _backup_content_36741456 = get('content', _marker) # -> _value try: _value = getitem('nothing') except: rcontext.setdefault('__error__', []).append((u'nothing', 1, 52, '', _sys.exc_info()[1], )) raise econtext['content'] = _value _backup_attrs_39812776 = get('attrs', _marker) # name=None at 2658710> -> _value _value = _static_40208784 econtext['attrs'] = _value # ') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_38435368 = get('attrs', _marker) # name=None at 2521f90> -> _value _value = _static_38935504 econtext['attrs'] = _value # ') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) if (_slot_title is None): _backup_has_title_38932944 = get('has_title', _marker) # -> _value try: try: _ignore = getitem('title') except (AttributeError, LookupError, TypeError, NameError, KeyError, ): _value = 0 else: _value = 1 except: rcontext.setdefault('__error__', []).append((u'exists: title', 4, 33, '', _sys.exc_info()[1], )) raise econtext['has_title'] = _value _backup_attrs_36811840 = get('attrs', _marker) # name=None at 2521050> -> _value _value = _static_38935440 econtext['attrs'] = _value # ') _backup_default_38436088 = get('default', _marker) # <Marker name='default' at 2521490> -> _value _value = _marker_default econtext['default'] = _value # <Expression u'title if has_title else default' (5:24)> -> _cache_38935120 try: _cache_38935120 = (getitem('title') if getitem('has_title') else getitem('default')) except: rcontext.setdefault('__error__', []).append((u'title if has_title else default', 5, 24, '<string>', _sys.exc_info()[1], )) raise # <Identity expression=<Expression u'title if has_title else default' (5:24)> value=<Marker name='default' at 2521f50> at 2521790> -> _condition _expression = _cache_38935120 # <Marker name='default' at 2521f50> -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'Master template' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_38935120 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_38436088 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_38436088 append(u'') if (_backup_attrs_36811840 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36811840 if (_backup_has_title_38932944 is _marker): del econtext['has_title'] else: econtext['has_title'] = _backup_has_title_38932944 else: _slot_title(stream, econtext.copy(), econtext) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'') if (_backup_attrs_38435368 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38435368 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36813640 = get('attrs', _marker) # name=None at 249fc10> -> _value _value = _static_38402704 econtext['attrs'] = _value # ') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36813496 = get('attrs', _marker) # name=None at 261f210> -> _value _value = _static_39973456 econtext['attrs'] = _value #
') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) if (_slot_content is None): _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _slot_content(stream, econtext.copy(), econtext) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'
') if (_backup_attrs_36813496 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36813496 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) _backup_attrs_36812632 = get('attrs', _marker) # name=None at 261fad0> -> _value _value = _static_39975056 econtext['attrs'] = _value #
') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) if (_slot_body_footer is None): _backup_default_36811120 = get('default', _marker) # -> _value _value = _marker_default econtext['default'] = _value # -> _cache_39976784 try: _cache_39976784 = getitem('nothing') except: rcontext.setdefault('__error__', []).append((u'nothing', 14, 59, '', _sys.exc_info()[1], )) raise # value= at 261f6d0> -> _condition _expression = _cache_39976784 # -> _value _value = _marker_default _condition = (_expression is _value) if _condition: _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'') _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) else: _content = _cache_39976784 if (_content is None): pass else: if (_content is False): _content = None else: _tt = type(_content) if ((_tt is int) or (_tt is float) or (_tt is long)): _content = unicode(_content) else: try: if (_tt is str): _content = decode(_content) else: if (_tt is not unicode): try: _content = _content.__html__ except: _content = convert(_content) else: raise RuntimeError except RuntimeError: _content = _content() else: if ((_content is not None) and (re_needs_escape(_content) is not None)): if ('&' in _content): if (';' in _content): _content = re_amp.sub('&', _content) else: _content = _content.replace('&', '&') if ('<' in _content): _content = _content.replace('<', '<') if ('>' in _content): _content = _content.replace('>', '>') if ('\x00' in _content): _content = _content.replace('\x00', '"') if (_content is not None): append(_content) if (_backup_default_36811120 is _marker): del econtext['default'] else: econtext['default'] = _backup_default_36811120 else: _slot_body_footer(stream, econtext.copy(), econtext) _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'
') if (_backup_attrs_36812632 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36812632 _content_139955154988272 = u'\n ' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'') if (_backup_attrs_36813640 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_36813640 _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'') if (_backup_attrs_39812776 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_39812776 if (_backup_content_36741456 is _marker): del econtext['content'] else: econtext['content'] = _backup_content_36741456 def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') render_main(stream, econtext.copy(), rcontext) econtext.update(rcontext) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) passChameleon-2.24/src/chameleon/tests/inputs/032.xml0000644000175000001440000000014411445675021022225 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/033-use-macro-trivial.pt0000644000175000001440000000011111450436720025401 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/033-use-macro-trivial.pt.py0000600000175000001440000000215611547550677026052 0ustar mborchusers00000000000000# -*- coding: utf-8 -*- pass import sys as _sys pass import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') # -> _macro try: _macro = getitem('load')('032-master-template.pt').macros['main'] except: rcontext.setdefault('__error__', []).append((u"load('032-master-template.pt').macros['main']", 1, 23, '', _sys.exc_info()[1], )) raise _macro.include(stream, econtext.copy(), rcontext) econtext.update(rcontext) _content_139955154988272 = u'\n' if (_content_139955154988272 is not None): append(_content_139955154988272) passChameleon-2.24/src/chameleon/tests/inputs/033.xml0000644000175000001440000000016511445675021022231 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/034-use-template-as-macro.pt0000644000175000001440000000007111450412655026152 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/034-use-template-as-macro.pt.py0000600000175000001440000000170411547550677026613 0ustar mborchusers00000000000000# -*- coding: utf-8 -*- pass import sys as _sys pass import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') # -> _macro try: _macro = getitem('load')('032-master-template.pt') except: rcontext.setdefault('__error__', []).append((u"load('032-master-template.pt')", 1, 23, '', _sys.exc_info()[1], )) raise _macro.include(stream, econtext.copy(), rcontext) econtext.update(rcontext) passChameleon-2.24/src/chameleon/tests/inputs/034.xml0000644000175000001440000000006711445675021022233 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/035-use-macro-with-fill-slot.pt0000644000175000001440000000024511711707354026623 0ustar mborchusers00000000000000 ${kind} title Chameleon-2.24/src/chameleon/tests/inputs/035-use-macro-with-fill-slot.pt.py0000600000175000001440000001202211547550677027251 0ustar mborchusers00000000000000# -*- coding: utf-8 -*- pass import sys as _sys pass _static_39975056 = {} import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') def _slot_title(stream, econtext, rcontext, _i18n_domain=_i18n_domain): getitem = econtext.__getitem__ get = econtext.get _backup_kind_37140176 = get('kind', _marker) # -> _value try: _value = 'New' except: rcontext.setdefault('__error__', []).append((u"'New'", 2, 50, '', _sys.exc_info()[1], )) raise econtext['kind'] = _value _backup_attrs_38600784 = get('attrs', _marker) # name=None at 261fc50> -> _value _value = _static_39975056 econtext['attrs'] = _value # ') # <Expression u'kind' (3:6)> -> _content_139955154988272 try: _content_139955154988272 = getitem('kind') except: rcontext.setdefault('__error__', []).append((u'kind', 3, 6, '<string>', _sys.exc_info()[1], )) raise if (_content_139955154988272 is None): pass else: if (_content_139955154988272 is False): _content_139955154988272 = None else: _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = unicode(_content_139955154988272) else: try: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except: _content_139955154988272 = convert(_content_139955154988272) else: raise RuntimeError except RuntimeError: _content_139955154988272 = _content_139955154988272() else: if ((_content_139955154988272 is not None) and (re_needs_escape(_content_139955154988272) is not None)): if ('&' in _content_139955154988272): if (';' in _content_139955154988272): _content_139955154988272 = re_amp.sub('&', _content_139955154988272) else: _content_139955154988272 = _content_139955154988272.replace('&', '&') if ('<' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('<', '<') if ('>' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('>', '>') if ('\x00' in _content_139955154988272): _content_139955154988272 = _content_139955154988272.replace('\x00', '"') _content_139955154988272 = ('%s%s%s' % ((u'\n ' if (u'\n ' is not None) else ''), (_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u' title\n ' if (u' title\n ' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) append(u'') if (_backup_attrs_38600784 is _marker): del econtext['attrs'] else: econtext['attrs'] = _backup_attrs_38600784 if (_backup_kind_37140176 is _marker): del econtext['kind'] else: econtext['kind'] = _backup_kind_37140176 try: _slots = getitem(u'_slot_title') except: _slots = econtext[u'_slot_title'] = [_slot_title, ] else: _slots.append(_slot_title) # -> _macro try: _macro = getitem('load')('032-master-template.pt').macros['main'] except: rcontext.setdefault('__error__', []).append((u"load('032-master-template.pt').macros['main']", 1, 23, '', _sys.exc_info()[1], )) raise _macro.include(stream, econtext.copy(), rcontext) econtext.update(rcontext) passChameleon-2.24/src/chameleon/tests/inputs/035.xml0000644000175000001440000000007011445675021022226 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/036-use-macro-inherits-dynamic-scope.pt0000644000175000001440000000016311450644604030321 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/036.xml0000644000175000001440000000011111445675021022223 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/037-use-macro-local-variable-scope.pt0000644000175000001440000000030311450651744027727 0ustar mborchusers00000000000000 ok Chameleon-2.24/src/chameleon/tests/inputs/037.xml0000644000175000001440000000012011445675021022224 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/038-use-macro-globals.pt0000644000175000001440000000021411450666037025371 0ustar mborchusers00000000000000 ok Chameleon-2.24/src/chameleon/tests/inputs/038.xml0000644000175000001440000000012011445675021022225 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/039-globals.pt0000644000175000001440000000005411450663405023477 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/039.xml0000644000175000001440000000011111445675021022226 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/040-macro-using-template-symbol.pt0000644000175000001440000000153711450701313027402 0ustar mborchusers00000000000000 ${foo}
Chameleon-2.24/src/chameleon/tests/inputs/040.xml0000644000175000001440000000017511445675021022230 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/041-translate-nested-names.pt0000644000175000001440000000076511470435213026430 0ustar mborchusers00000000000000
Hello world!
Hello world!
Goodbye world!
Chameleon-2.24/src/chameleon/tests/inputs/041.xml0000644000175000001440000000015111445675021022223 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/042-use-macro-fill-footer.pt0000644000175000001440000000022011501223221026135 0ustar mborchusers00000000000000 New footer Chameleon-2.24/src/chameleon/tests/inputs/042.xml0000644000175000001440000000014211445675021022224 0ustar mborchusers00000000000000 ]> A Chameleon-2.24/src/chameleon/tests/inputs/043-macro-nested-dynamic-vars.pt0000644000175000001440000000061411504611130027011 0ustar mborchusers00000000000000 ${title}
Chameleon-2.24/src/chameleon/tests/inputs/043.xml0000644000175000001440000000015411445675021022230 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/044-tuple-define.pt0000644000175000001440000000011611530322743024424 0ustar mborchusers00000000000000 ${a}, ${b} Chameleon-2.24/src/chameleon/tests/inputs/044.xml0000644000175000001440000000027311445675021022233 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/045-namespaces.pt0000644000175000001440000000104711535132161024165 0ustar mborchusers00000000000000 ]> ZZZ YYY XXX Chameleon-2.24/src/chameleon/tests/inputs/045.xml0000644000175000001440000000017011445675021022230 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/046-extend-macro.pt0000644000175000001440000000034511530504607024440 0ustar mborchusers00000000000000 New footer Chameleon-2.24/src/chameleon/tests/inputs/046.xml0000644000175000001440000000017011445675021022231 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/047-use-extended-macro.pt0000644000175000001440000000017211530505174025542 0ustar mborchusers00000000000000 Extended Chameleon-2.24/src/chameleon/tests/inputs/047.xml0000644000175000001440000000010011445675021022223 0ustar mborchusers00000000000000 ]> X Y Chameleon-2.24/src/chameleon/tests/inputs/048-use-extended-macro-fill-original.pt0000644000175000001440000000023611641065271030274 0ustar mborchusers00000000000000 Extended footer Chameleon-2.24/src/chameleon/tests/inputs/048.xml0000644000175000001440000000007511445675021022237 0ustar mborchusers00000000000000 ]> ] Chameleon-2.24/src/chameleon/tests/inputs/049-entities-in-attributes.pt0000644000175000001440000000070711665421275026503 0ustar mborchusers00000000000000
    
    
  
  
    
  
Chameleon-2.24/src/chameleon/tests/inputs/058.xml0000644000175000001440000000015711445675021022241 0ustar  mborchusers00000000000000

]>

Chameleon-2.24/src/chameleon/tests/inputs/059-embedded-javascript.pt0000644000175000001440000000025611535126506025757 0ustar  mborchusers00000000000000
  
    test
    test
  

Chameleon-2.24/src/chameleon/tests/inputs/059.xml0000644000175000001440000000034311445675021022237 0ustar  mborchusers00000000000000


]>





Chameleon-2.24/src/chameleon/tests/inputs/060-macro-with-multiple-same-slots.pt0000644000175000001440000000033711547545705030053 0ustar  mborchusers00000000000000
  
    <metal:title define-slot="title">Untitled</metal:title>
  
  
    

Untitled

Chameleon-2.24/src/chameleon/tests/inputs/060.xml0000644000175000001440000000010311445675021022221 0ustar mborchusers00000000000000 ]> X Y Chameleon-2.24/src/chameleon/tests/inputs/061-fill-one-slot-but-two-defined.pt0000644000175000001440000000023011547545735027536 0ustar mborchusers00000000000000 My document Chameleon-2.24/src/chameleon/tests/inputs/061.xml0000644000175000001440000000010211445675021022221 0ustar mborchusers00000000000000 ]> £ Chameleon-2.24/src/chameleon/tests/inputs/062-comments-and-expressions.pt0000644000175000001440000000056411620466453027026 0ustar mborchusers00000000000000
Chameleon-2.24/src/chameleon/tests/inputs/062.xml0000644000175000001440000000012711445675021022231 0ustar mborchusers00000000000000 ]> เจมส์ Chameleon-2.24/src/chameleon/tests/inputs/063-continuation.pt0000644000175000001440000000010311613337164024557 0ustar mborchusers00000000000000
${foo}
Chameleon-2.24/src/chameleon/tests/inputs/063.xml0000644000175000001440000000015411445675021022232 0ustar mborchusers00000000000000 ]> <เจมส์> Chameleon-2.24/src/chameleon/tests/inputs/064-tags-and-special-characters.pt0000644000175000001440000000010511607240251027272 0ustar mborchusers00000000000000
Chameleon-2.24/src/chameleon/tests/inputs/064.xml0000644000175000001440000000011711445675021022232 0ustar mborchusers00000000000000 ]> 𐀀􏿽 Chameleon-2.24/src/chameleon/tests/inputs/065-use-macro-in-fill.pt0000644000175000001440000000042411613214577025302 0ustar mborchusers00000000000000 <div metal:fill-slot="content">Content</div> </html>��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/065.xml���������������������������������������������������0000644�0001750�0000144�00000000121�11445675021�022226� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ENTITY e "<"> <!ELEMENT doc (#PCDATA)> ]> <doc></doc> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/066-load-expression.pt������������������������������������0000644�0001750�0000144�00000000125�11671570523�025172� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html tal:define="hello_world load: hello_world.pt" metal:use-macro="hello_world" /> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/066.xml���������������������������������������������������0000644�0001750�0000144�00000000233�11445675021�022233� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA #IMPLIED> <!-- 34 is double quote --> <!ENTITY e1 """> ]> <doc a1="&e1;"></doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/067-attribute-decode.pt�����������������������������������0000644�0001750�0000144�00000000311�11620445601�025270� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <img src="#" tal:attributes="class 1 > 0 and 'up' or 0 < 1 and 'down';" /> <img src="#" tal:attributes="class 0 > 1 and 'up' or 0 < 1 and 'down';" /> </body> </html> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/067.xml���������������������������������������������������0000644�0001750�0000144�00000000101�11445675021�022226� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> ]> <doc> </doc> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/068-less-than-greater-than-in-attributes.pt���������������0000644�0001750�0000144�00000000322�11620447275�031125� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html> <body> <span tal:content="string:0 < 1 or 0 > 1" /> <span tal:content="structure string:0 < 1 or 0 > 1" /> <span class="0 < 1 or 0 > 1" /> <span>0 < 1 or 0 > 1</span> </body> </html> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/068.xml���������������������������������������������������0000644�0001750�0000144�00000000124�11445675021�022234� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE doc [ <!ELEMENT doc (#PCDATA)> <!ENTITY e " "> ]> <doc>&e;</doc> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Chameleon-2.24/src/chameleon/tests/inputs/069-translation-domain-and-macro.pt�����������������������0000644�0001750�0000144�00000000247�11620714244�027522� 0����������������������������������������������������������������������������������������������������ustar �mborch��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<html metal:use-macro="load('032-master-template.pt').macros['main']"> <title metal:fill-slot="title" i18n:domain="test" i18n:translate="title">Title Chameleon-2.24/src/chameleon/tests/inputs/069.xml0000644000175000001440000000013511445675021022237 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/070-translation-domain-and-use-macro.pt0000644000175000001440000000024711620714335030305 0ustar mborchusers00000000000000 Title Chameleon-2.24/src/chameleon/tests/inputs/070.xml0000644000175000001440000000012111445675021022222 0ustar mborchusers00000000000000"> %e; ]> Chameleon-2.24/src/chameleon/tests/inputs/071-html-attribute-defaults.pt0000644000175000001440000000105312425710015026613 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/071.xml0000644000175000001440000000013211445675021022225 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/072-repeat-interpolation.pt0000644000175000001440000000054711634104364026223 0ustar mborchusers00000000000000
  • ${i}
  • ${i}
  • ${i}
Chameleon-2.24/src/chameleon/tests/inputs/072.xml0000644000175000001440000000013511445675021022231 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/073-utf8-encoded.pt0000644000175000001440000000022311634410073024330 0ustar mborchusers00000000000000 ${'my title'} — ${'my site'} Chameleon-2.24/src/chameleon/tests/inputs/073.xml0000644000175000001440000000013611445675021022233 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/074-encoded-template.pt0000644000175000001440000000025111634406312025260 0ustar mborchusers00000000000000 ${'my title'} — ${'my site'} Chameleon-2.24/src/chameleon/tests/inputs/074.xml0000644000175000001440000000013611445675021022234 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/075-nested-macros.pt0000644000175000001440000000043211650737465024632 0ustar mborchusers00000000000000 foo Chameleon-2.24/src/chameleon/tests/inputs/075.xml0000644000175000001440000000014011445675021022230 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/076-nested-macro-override.pt0000644000175000001440000000021211650741576026257 0ustar mborchusers00000000000000 bar Chameleon-2.24/src/chameleon/tests/inputs/076.xml0000644000175000001440000000030011445675021022227 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/077-i18n-attributes.pt0000644000175000001440000000015011653731350025016 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/077.xml0000644000175000001440000000013511445675021022236 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/078-tags-and-newlines.pt0000644000175000001440000000143612240710222025370 0ustar mborchusers00000000000000 , Chameleon-2.24/src/chameleon/tests/inputs/078.xml0000644000175000001440000000014411445675021022237 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/079-implicit-i18n.pt0000644000175000001440000000064412124313107024442 0ustar mborchusers00000000000000 Welcome

Welcome

An edge case: ${. Site logo Site logo
boo foo.
bar.
Chameleon-2.24/src/chameleon/tests/inputs/079.xml0000644000175000001440000000014511445675021022241 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/080-xmlns-namespace-on-tal.pt0000644000175000001440000000037211663637075026350 0ustar mborchusers00000000000000 Hello world Chameleon-2.24/src/chameleon/tests/inputs/080.xml0000644000175000001440000000013711445675021022232 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/081-load-spec.pt0000644000175000001440000000010611671572761023727 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/081.xml0000644000175000001440000000021411445675021022227 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/082-load-spec-computed.pt0000644000175000001440000000014211671573267025550 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/082.xml0000644000175000001440000000013211445675021022227 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/083-template-dict-to-macro.pt0000644000175000001440000000014411672116410026321 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/083.xml0000644000175000001440000000014511445675021022234 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/084-interpolation-in-cdata.pt0000644000175000001440000000017111676543237026433 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/084.xml0000644000175000001440000000006611445675021022237 0ustar mborchusers00000000000000]> Chameleon-2.24/src/chameleon/tests/inputs/085-nested-translation.pt0000644000175000001440000000046511700570274025700 0ustar mborchusers00000000000000 Welcome

Welcome

Click here to continue.

Chameleon-2.24/src/chameleon/tests/inputs/085.xml0000644000175000001440000000014611445675021022237 0ustar mborchusers00000000000000 "> ]> &e; Chameleon-2.24/src/chameleon/tests/inputs/086-self-closing.pt0000644000175000001440000000037311711707413024445 0ustar mborchusers00000000000000
Chameleon-2.24/src/chameleon/tests/inputs/086.xml0000644000175000001440000000014411445675021022236 0ustar mborchusers00000000000000 "> ]> &e; Chameleon-2.24/src/chameleon/tests/inputs/087-code-blocks.pt0000644000175000001440000000067311723354553024257 0ustar mborchusers00000000000000
Please input a number from the range ${", ".join(numbers)}.
41 + 1 = ${function(41)}.
Chameleon-2.24/src/chameleon/tests/inputs/087.xml0000644000175000001440000000015311445675021022237 0ustar mborchusers00000000000000 ]> &e; Chameleon-2.24/src/chameleon/tests/inputs/088-python-newlines.pt0000644000175000001440000000007711725576135025240 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/088.xml0000644000175000001440000000012711445675021022241 0ustar mborchusers00000000000000 "> ]> &e; Chameleon-2.24/src/chameleon/tests/inputs/089-load-fallback.pt0000644000175000001440000000017412035472070024534 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/inputs/089.xml0000644000175000001440000000015411445675021022242 0ustar mborchusers00000000000000 ]> &e; Chameleon-2.24/src/chameleon/tests/inputs/090-tuple-expression.pt0000644000175000001440000000044112113342470025370 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/090.xml0000644000175000001440000000022611445675021022232 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/091-repeat-none.pt0000644000175000001440000000011312330133456024257 0ustar mborchusers00000000000000
error
Chameleon-2.24/src/chameleon/tests/inputs/091.xml0000644000175000001440000000026511445675021022236 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/092.xml0000644000175000001440000000014611445675021022235 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/093.xml0000644000175000001440000000007411445675021022236 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/094.xml0000644000175000001440000000016011445675021022233 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/095.xml0000644000175000001440000000021511445675021022235 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/096.xml0000644000175000001440000000014311445675021022236 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/097.xml0000644000175000001440000000023511445675021022241 0ustar mborchusers00000000000000 %e; ]> Chameleon-2.24/src/chameleon/tests/inputs/098.xml0000644000175000001440000000010711445675021022240 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/099.xml0000644000175000001440000000014411445675021022242 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/100.xml0000644000175000001440000000014511445675021022222 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/101-unclosed-tags.html0000644000175000001440000000010311474663644025141 0ustar mborchusers00000000000000



Hello world

Chameleon-2.24/src/chameleon/tests/inputs/101.xml0000644000175000001440000000012111445675021022215 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/102-unquoted-attributes.html0000644000175000001440000000012411474722745026423 0ustar mborchusers00000000000000

Hello world

Chameleon-2.24/src/chameleon/tests/inputs/102.xml0000644000175000001440000000014711445675021022226 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/103-simple-attribute.html0000644000175000001440000000032011474712662025661 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/inputs/103.xml0000644000175000001440000000010511445675021022221 0ustar mborchusers00000000000000 ]> <doc> Chameleon-2.24/src/chameleon/tests/inputs/104.xml0000644000175000001440000000014511445675021022226 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/105.xml0000644000175000001440000000015011445675021022223 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/106.xml0000644000175000001440000000015111445675021022225 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/107.xml0000644000175000001440000000015111445675021022226 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/108.xml0000644000175000001440000000017111445675021022231 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/109.xml0000644000175000001440000000014211445675021022230 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/110.xml0000644000175000001440000000020111445675021022214 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/111.xml0000644000175000001440000000017311445675021022225 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/112.xml0000644000175000001440000000013111445675021022220 0ustar mborchusers00000000000000 ]>
Chameleon-2.24/src/chameleon/tests/inputs/113.xml0000644000175000001440000000013311445675021022223 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/114.xml0000644000175000001440000000014011445675021022222 0ustar mborchusers00000000000000 "> ]> &e; Chameleon-2.24/src/chameleon/tests/inputs/115.xml0000644000175000001440000000014711445675021022232 0ustar mborchusers00000000000000 ]> &e1; Chameleon-2.24/src/chameleon/tests/inputs/116.xml0000644000175000001440000000011211676543142022227 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/117.xml0000644000175000001440000000012611445675021022231 0ustar mborchusers00000000000000 ]> ] Chameleon-2.24/src/chameleon/tests/inputs/118.xml0000644000175000001440000000012711445675021022233 0ustar mborchusers00000000000000 ]> ] Chameleon-2.24/src/chameleon/tests/inputs/119.xml0000644000175000001440000000010211445675021022225 0ustar mborchusers00000000000000 ]> Chameleon-2.24/src/chameleon/tests/inputs/120-translation-context.pt0000644000175000001440000000042712425710015026060 0ustar mborchusers00000000000000
Hello world!
Tab
Chameleon-2.24/src/chameleon/tests/inputs/121-translation-comment.pt0000644000175000001440000000016412452720367026050 0ustar mborchusers00000000000000

Hello world!

Chameleon-2.24/src/chameleon/tests/inputs/122-translation-ignore.pt0000644000175000000120000000034112614070165025616 0ustar mborchwheel00000000000000

Hello world!

Python is a programming language. Chameleon-2.24/src/chameleon/tests/inputs/123-html5-data-attributes.pt0000644000175000000120000000013212614070165026122 0ustar mborchwheel00000000000000
Chameleon-2.24/src/chameleon/tests/inputs/greeting.pt0000644000175000001440000000005111634317676023356 0ustar mborchusers00000000000000
Hello, ${name | 'undefined'}.
Chameleon-2.24/src/chameleon/tests/inputs/hello_world.pt0000644000175000001440000000006711532677462024072 0ustar mborchusers00000000000000 ${'Hello world!'} Chameleon-2.24/src/chameleon/tests/inputs/hello_world.txt0000644000175000001440000000002211532701062024235 0ustar mborchusers00000000000000${'Hello world!'} Chameleon-2.24/src/chameleon/tests/inputs/hello_world.txt.py0000600000175000001440000000347111547550677024713 0ustar mborchusers00000000000000# -*- coding: utf-8 -*- pass import sys as _sys pass import re import functools _marker = object() g_re_amp = re.compile('&(?!([A-Za-z]+|#[0-9]+);)') g_re_needs_escape = re.compile('[&<>\\"\\\']').search re_whitespace = functools.partial(re.compile('\\s+').sub, ' ') def render(stream, econtext, rcontext): append = stream.append getitem = econtext.__getitem__ get = econtext.get _i18n_domain = None re_amp = g_re_amp re_needs_escape = g_re_needs_escape decode = getitem('decode') convert = getitem('convert') translate = getitem('translate') # -> _content_139955154988272 try: _content_139955154988272 = 'Hello world!' except: rcontext.setdefault('__error__', []).append((u"'Hello world!'", 1, 2, '', _sys.exc_info()[1], )) raise if (_content_139955154988272 is not None): _tt = type(_content_139955154988272) if ((_tt is int) or (_tt is float) or (_tt is long)): _content_139955154988272 = str(_content_139955154988272) else: if (_tt is str): _content_139955154988272 = decode(_content_139955154988272) else: if (_tt is not unicode): try: _content_139955154988272 = _content_139955154988272.__html__ except AttributeError: _content_139955154988272 = convert(_content_139955154988272) else: _content_139955154988272 = _content_139955154988272() _content_139955154988272 = ('%s%s' % ((_content_139955154988272 if (_content_139955154988272 is not None) else ''), (u'\n' if (u'\n' is not None) else ''), )) if (_content_139955154988272 is not None): append(_content_139955154988272) passChameleon-2.24/src/chameleon/tests/outputs/0000755000175000000120000000000012614070273021333 5ustar mborchwheel00000000000000Chameleon-2.24/src/chameleon/tests/outputs/001.html0000644000175000001440000000012511450131562022556 0ustar mborchusers00000000000000 Hello world! Hello world! Goodbye world! Chameleon-2.24/src/chameleon/tests/outputs/001.pt0000644000175000001440000000007511613337140022242 0ustar mborchusers00000000000000 Hello world! ok Chameleon-2.24/src/chameleon/tests/outputs/001.txt0000644000175000001440000000002111531710247022427 0ustar mborchusers00000000000000<&> Chameleon-2.24/src/chameleon/tests/outputs/002.pt0000644000175000001440000000027711474511115022250 0ustar mborchusers00000000000000
Hello! Hello.
Goodbye! Goodbye.
ok Chameleon-2.24/src/chameleon/tests/outputs/003.pt0000644000175000001440000000054311623430232022241 0ustar mborchusers00000000000000
Hello world!
Hello world!
1 2
Hello world!
Hello world!
3
Hello world!
5 6
Hello world!
1
1.0
True
False
0
<div>Hello world!</div> Chameleon-2.24/src/chameleon/tests/outputs/004.pt0000644000175000001440000000116612035273057022254 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/005.pt0000644000175000001440000000030711623430361022244 0ustar mborchusers00000000000000 Default True False Computed default Chameleon-2.24/src/chameleon/tests/outputs/006.pt0000644000175000001440000000037411637044304022254 0ustar mborchusers00000000000000 copyright (c) 2010 copyright (c) 2010 copyright (c) 2010 $ignored <type 'str'> Chameleon-2.24/src/chameleon/tests/outputs/007.pt0000644000175000001440000000036312034551646022257 0ustar mborchusers00000000000000 Hello world!
Hello world!
Hello world!
<type 'str'> && Hello world $leftalone
Hello world
${} is ignored.
Chameleon-2.24/src/chameleon/tests/outputs/008.pt0000644000175000001440000000017712034532615022256 0ustar mborchusers00000000000000 {}
static
nothing
Chameleon-2.24/src/chameleon/tests/outputs/009.pt0000644000175000001440000000007611445675021022261 0ustar mborchusers00000000000000
Hello world!
Chameleon-2.24/src/chameleon/tests/outputs/010.pt0000644000175000001440000000024411614001244022232 0ustar mborchusers00000000000000
1 < 2
2 < 3, 2&3, 2<3, 2>3
3 < 4
4 < 5
Hello world!
Chameleon-2.24/src/chameleon/tests/outputs/011-en.pt0000644000175000001440000000046411445675021022653 0ustar mborchusers00000000000000
Message ('message' translation into 'en')
Message ('message' translation into 'en')
Message ('message' translation into 'en')
Message ('message' translation into 'en')
Message ('message' translation into 'en') Chameleon-2.24/src/chameleon/tests/outputs/011.pt0000644000175000001440000000021211445675021022242 0ustar mborchusers00000000000000
Message
Message
Message
Message
Message Chameleon-2.24/src/chameleon/tests/outputs/012-en.pt0000644000175000001440000000076112035501160022640 0ustar mborchusers00000000000000
Hello world! ('Hello world!' translation into 'en')
Hello world! ('hello_world' translation into 'en')
Hello world! ('Hello world!' translation into 'en')
Hello world! Goodbye planet! ('Hello ${first}! Goodbye ${second}!' translation into 'en')
Hello world! Goodbye planet! ('hello_goodbye' translation into 'en')
Chameleon-2.24/src/chameleon/tests/outputs/012.pt0000644000175000001440000000041512035501153022236 0ustar mborchusers00000000000000
Hello world!
Hello world!
Hello world!
Hello world! Goodbye planet!
Hello world! Goodbye planet!
Chameleon-2.24/src/chameleon/tests/outputs/013.pt0000644000175000001440000000042511445675021022252 0ustar mborchusers00000000000000
[1,1] [1,2]
[2,1] [2,2]
Chameleon-2.24/src/chameleon/tests/outputs/014.pt0000644000175000001440000000026411445675021022254 0ustar mborchusers00000000000000 [3,3] [3,4] [4,3] [4,4] Chameleon-2.24/src/chameleon/tests/outputs/015-en.pt0000644000175000001440000000026311447145253022655 0ustar mborchusers00000000000000
Price: Per kilo 12.5 ('Per kilo ${amount}' translation into 'en') ('Price: ${price}' translation into 'en')
Chameleon-2.24/src/chameleon/tests/outputs/015.pt0000644000175000001440000000013411447145277022260 0ustar mborchusers00000000000000
Price: Per kilo 12.5
Chameleon-2.24/src/chameleon/tests/outputs/016-en.pt0000644000175000001440000000057311445675021022661 0ustar mborchusers00000000000000
Hello world! ('Hello world!' translation into 'en')
Hello world! ('Hello world!' translation into 'en') Hello world! ('hello_world' translation into 'en') Hello world! ('Hello world!' translation into 'en') Hello world! ('hello_world' translation into 'en') Chameleon-2.24/src/chameleon/tests/outputs/016.pt0000644000175000001440000000027211445675021022255 0ustar mborchusers00000000000000
Hello world!
Hello world! Hello world! Hello world! Hello world! Chameleon-2.24/src/chameleon/tests/outputs/017.pt0000644000175000001440000000024011445675021022251 0ustar mborchusers00000000000000 Hello world! 1 Hello world! 23 4Hello world!
Hello world!
Hello world! Hello world! Chameleon-2.24/src/chameleon/tests/outputs/018-en.pt0000644000175000001440000000026111530420157022646 0ustar mborchusers00000000000000
october ('october' translation into 'en') 1982 ('1982' translation into 'en') ('${monthname} ${year}' translation into 'en')
Chameleon-2.24/src/chameleon/tests/outputs/018.pt0000644000175000001440000000010111530420146022235 0ustar mborchusers00000000000000
october 1982
Chameleon-2.24/src/chameleon/tests/outputs/019.pt0000644000175000001440000000024211623430401022242 0ustar mborchusers00000000000000 Hello world! Hello world!1 2Hello world! Hello world!3 Hello world!5 6Hello world! 1 1.0 True Chameleon-2.24/src/chameleon/tests/outputs/020.pt0000644000175000001440000000020511762130541022237 0ustar mborchusers00000000000000
NameError thrown at 5:24.
Chameleon-2.24/src/chameleon/tests/outputs/021-en.pt0000644000175000001440000000063611447150716022656 0ustar mborchusers00000000000000
Hello world! ('Hello world!' translation into 'en' with domain 'new')
Hello world! ('Hello world!' translation into 'en' with domain 'old')
Hello world!
Hello world!
Chameleon-2.24/src/chameleon/tests/outputs/021.pt0000644000175000001440000000030411447150735022247 0ustar mborchusers00000000000000
Hello world!
Hello world!
Hello world!
Hello world!
Chameleon-2.24/src/chameleon/tests/outputs/022.pt0000644000175000001440000000026312115344433022245 0ustar mborchusers00000000000000
ok ok
ok
ok
Chameleon-2.24/src/chameleon/tests/outputs/023.pt0000644000175000001440000000006711527750230022252 0ustar mborchusers00000000000000 ok Chameleon-2.24/src/chameleon/tests/outputs/024.pt0000644000175000001440000000011511527750370022252 0ustar mborchusers00000000000000 first second ok Chameleon-2.24/src/chameleon/tests/outputs/025.pt0000644000175000001440000000036312240710021022236 0ustar mborchusers00000000000000
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1, 2, 3 .
Chameleon-2.24/src/chameleon/tests/outputs/026.pt0000644000175000001440000000053311533700022022242 0ustar mborchusers00000000000000
  • 0
  • 1
  • 2
  • 0
  • 1
  • 2
  • even
  • odd
  • even
Chameleon-2.24/src/chameleon/tests/outputs/027.pt0000644000175000001440000000026311530420176022251 0ustar mborchusers00000000000000
abcghi Hello World! Hello World!
Chameleon-2.24/src/chameleon/tests/outputs/028.pt0000644000175000001440000000017611623433117022257 0ustar mborchusers00000000000000
Chameleon-2.24/src/chameleon/tests/outputs/029.pt0000644000175000001440000000015311530420217022245 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/030.pt0000644000175000001440000000015011450404371022236 0ustar mborchusers00000000000000
1, 1, 2
2, 3, 4
Chameleon-2.24/src/chameleon/tests/outputs/031.pt0000644000175000001440000000010712240710057022240 0ustar mborchusers00000000000000
Hello World! Hello World! Hello World! 012 True
Chameleon-2.24/src/chameleon/tests/outputs/032.pt0000644000175000001440000000027411530164370022250 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/033.pt0000644000175000001440000000027411530177642022257 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/034.pt0000644000175000001440000000027411530206346022252 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/035.pt0000644000175000001440000000027511530206353022252 0ustar mborchusers00000000000000 New title
Chameleon-2.24/src/chameleon/tests/outputs/036.pt0000644000175000001440000000026611530206360022251 0ustar mborchusers00000000000000 New title
Chameleon-2.24/src/chameleon/tests/outputs/037.pt0000644000175000001440000000026211530207463022253 0ustar mborchusers00000000000000 Master template
ok
Chameleon-2.24/src/chameleon/tests/outputs/038.pt0000644000175000001440000000006711450666064022266 0ustar mborchusers00000000000000 ok Chameleon-2.24/src/chameleon/tests/outputs/039.pt0000644000175000001440000000000011450666100022241 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/outputs/040.pt0000644000175000001440000000071211530420223022234 0ustar mborchusers00000000000000 foo Chameleon-2.24/src/chameleon/tests/outputs/041.pt0000644000175000001440000000021311474531133022243 0ustar mborchusers00000000000000
Hello world!
Hello world!
Goodbye
Chameleon-2.24/src/chameleon/tests/outputs/042.pt0000644000175000001440000000031311530211522022233 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/043.pt0000644000175000001440000000007011530211567022245 0ustar mborchusers00000000000000 My title Chameleon-2.24/src/chameleon/tests/outputs/044.pt0000644000175000001440000000005311530322766022253 0ustar mborchusers00000000000000 a, b Chameleon-2.24/src/chameleon/tests/outputs/045.pt0000644000175000001440000000071711535132165022260 0ustar mborchusers00000000000000 ]> ZZZ YYY XXX Chameleon-2.24/src/chameleon/tests/outputs/046.pt0000644000175000001440000000033011530504512022242 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/047.pt0000644000175000001440000000033111530505232022244 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/048.pt0000644000175000001440000000032011530505245022247 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/049.pt0000644000175000001440000000032411665421726022266 0ustar mborchusers00000000000000
amp=&amp; lt=&lt;
amp=& lt=<
Chameleon-2.24/src/chameleon/tests/outputs/059.pt0000644000175000001440000000021611620242115022247 0ustar mborchusers00000000000000 test test Chameleon-2.24/src/chameleon/tests/outputs/060.pt0000644000175000001440000000014711547546013022256 0ustar mborchusers00000000000000 Untitled

Untitled

Chameleon-2.24/src/chameleon/tests/outputs/061.pt0000644000175000001440000000015411547570257022264 0ustar mborchusers00000000000000 My document

My document

Chameleon-2.24/src/chameleon/tests/outputs/062.pt0000644000175000001440000000043211620466455022260 0ustar mborchusers00000000000000
Chameleon-2.24/src/chameleon/tests/outputs/063.pt0000644000175000001440000000002011604560332022241 0ustar mborchusers00000000000000
2
Chameleon-2.24/src/chameleon/tests/outputs/064.pt0000644000175000001440000000005111607240261022245 0ustar mborchusers00000000000000
Chameleon-2.24/src/chameleon/tests/outputs/065.pt0000644000175000001440000000025211613214603022247 0ustar mborchusers00000000000000 Title
Content
Chameleon-2.24/src/chameleon/tests/outputs/066.pt0000644000175000001440000000006311614327666022267 0ustar mborchusers00000000000000 Hello world! Chameleon-2.24/src/chameleon/tests/outputs/067.pt0000644000175000001440000000014211620445571022257 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/068.pt0000644000175000001440000000025411620447301022255 0ustar mborchusers00000000000000 0 < 1 or 0 > 1 0 < 1 or 0 > 1 0 < 1 or 0 > 1 Chameleon-2.24/src/chameleon/tests/outputs/069-en.pt0000644000175000001440000000034411620463317022663 0ustar mborchusers00000000000000 Title ('title' translation into 'en' with domain 'test')
Chameleon-2.24/src/chameleon/tests/outputs/069.pt0000644000175000001440000000026111620460272022256 0ustar mborchusers00000000000000 Title
Chameleon-2.24/src/chameleon/tests/outputs/070-en.pt0000644000175000001440000000034411700567154022656 0ustar mborchusers00000000000000 Title ('title' translation into 'en' with domain 'test')
Chameleon-2.24/src/chameleon/tests/outputs/070.pt0000644000175000001440000000026111620714410022242 0ustar mborchusers00000000000000 Title
Chameleon-2.24/src/chameleon/tests/outputs/071.pt0000644000175000001440000000047012425710015022246 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/072.pt0000644000175000001440000000047411634104417022257 0ustar mborchusers00000000000000
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
Chameleon-2.24/src/chameleon/tests/outputs/073.pt0000644000175000001440000000021111634332673022254 0ustar mborchusers00000000000000 my title — my site Chameleon-2.24/src/chameleon/tests/outputs/074.pt0000644000175000001440000000023711634411127022255 0ustar mborchusers00000000000000 my title — my site Chameleon-2.24/src/chameleon/tests/outputs/075.pt0000644000175000001440000000026011650741404022254 0ustar mborchusers00000000000000 Master template
foo
Chameleon-2.24/src/chameleon/tests/outputs/076.pt0000644000175000001440000000031511650741734022264 0ustar mborchusers00000000000000 Master template
bar
Chameleon-2.24/src/chameleon/tests/outputs/077-en.pt0000644000175000001440000000017011653732243022662 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/outputs/077.pt0000644000175000001440000000010511653732207022260 0ustar mborchusers00000000000000Chameleon-2.24/src/chameleon/tests/outputs/078.pt0000644000175000001440000000043312240710115022250 0ustar mborchusers00000000000000 1, 2, 3 Chameleon-2.24/src/chameleon/tests/outputs/079-en.pt0000644000175000001440000000107312124313327022657 0ustar mborchusers00000000000000 Welcome ('Welcome' translation into 'en')

Welcome ('Welcome' translation into 'en')

An edge case: ${. ('An edge case: ${.' translation into 'en') Site logo ('Site logo' translation into 'en') Site logo ('Site logo' translation into 'en')
boo foo. ('boo foo.' translation into 'en')
bar. ('bar.' translation into 'en')
Chameleon-2.24/src/chameleon/tests/outputs/079.pt0000644000175000001440000000050112124313170022246 0ustar mborchusers00000000000000 Welcome

Welcome

An edge case: ${. Site logo Site logo
boo foo.
bar.
Chameleon-2.24/src/chameleon/tests/outputs/080.pt0000644000175000001440000000002111663637727022263 0ustar mborchusers00000000000000 Hello world Chameleon-2.24/src/chameleon/tests/outputs/081.pt0000644000175000001440000000006211671571772022265 0ustar mborchusers00000000000000 Hello world! Chameleon-2.24/src/chameleon/tests/outputs/082.pt0000644000175000001440000000006211671573273022264 0ustar mborchusers00000000000000 Hello world! Chameleon-2.24/src/chameleon/tests/outputs/083.pt0000644000175000001440000000027311672116460022261 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/084.pt0000644000175000001440000000016411676543312022265 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/085-en.pt0000644000175000001440000000044011700570352022653 0ustar mborchusers00000000000000 Welcome

Welcome

Click here ('Click here' translation into 'en' with domain 'new') to continue. ('${click_here} to continue.' translation into 'en' with domain 'new')

Chameleon-2.24/src/chameleon/tests/outputs/085.pt0000644000175000001440000000024211700570310022245 0ustar mborchusers00000000000000 Welcome

Welcome

Click here to continue.

Chameleon-2.24/src/chameleon/tests/outputs/086.pt0000644000175000001440000000041011711707506022256 0ustar mborchusers00000000000000 Master template
Chameleon-2.24/src/chameleon/tests/outputs/087.pt0000644000175000001440000000032711723356033022264 0ustar mborchusers00000000000000
  • 1
  • 2
  • 3
  • 5
  • 7
  • 9
Please input a number from the range 1, 2, 3, 4, 5, 6, 7, 8, 9.
41 + 1 = 42.
Chameleon-2.24/src/chameleon/tests/outputs/088.pt0000644000175000001440000000001011725576354022266 0ustar mborchusers00000000000000a, b, c Chameleon-2.24/src/chameleon/tests/outputs/089.pt0000644000175000001440000000006212035472134022260 0ustar mborchusers00000000000000 Hello world! Chameleon-2.24/src/chameleon/tests/outputs/090.pt0000644000175000001440000000041212113342464022246 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/091.pt0000644000175000001440000000004312330133460022242 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/101.html0000644000175000001440000000010311474655747022601 0ustar mborchusers00000000000000



Hello world

Chameleon-2.24/src/chameleon/tests/outputs/102.html0000644000175000001440000000012411474663732022576 0ustar mborchusers00000000000000

Hello world

Chameleon-2.24/src/chameleon/tests/outputs/103.html0000644000175000001440000000032011474712674022575 0ustar mborchusers00000000000000 Chameleon-2.24/src/chameleon/tests/outputs/120-en.pt0000644000175000001440000000045512425710015022644 0ustar mborchusers00000000000000
Hello world! ('Hello world!' translation into 'en')
Chameleon-2.24/src/chameleon/tests/outputs/120.pt0000644000175000001440000000020712425710015022237 0ustar mborchusers00000000000000
Hello world!
Tab
Chameleon-2.24/src/chameleon/tests/outputs/121.pt0000644000175000001440000000007412452720367022255 0ustar mborchusers00000000000000

Hello world!

Chameleon-2.24/src/chameleon/tests/outputs/122.pt0000644000175000000120000000025012614070165022201 0ustar mborchwheel00000000000000

Hello world!

Python is a programming language. Chameleon-2.24/src/chameleon/tests/outputs/123.pt0000644000175000000120000000011012614070165022175 0ustar mborchwheel00000000000000
Hello world!
Chameleon-2.24/src/chameleon/tests/outputs/greeting.pt0000644000175000001440000000003511634317703023550 0ustar mborchusers00000000000000
Hello, undefined.
Chameleon-2.24/src/chameleon/tests/outputs/hello_world.pt0000644000175000001440000000006211532677465024271 0ustar mborchusers00000000000000 Hello world! Chameleon-2.24/src/chameleon/tests/outputs/hello_world.txt0000644000175000001440000000001511532701100024431 0ustar mborchusers00000000000000Hello world! Chameleon-2.24/src/chameleon/tests/__init__.py0000644000175000001440000000000211447151137021756 0ustar mborchusers00000000000000# Chameleon-2.24/src/chameleon/tests/test_doctests.py0000644000175000001440000000177311614277405023131 0ustar mborchusers00000000000000import unittest import doctest OPTIONFLAGS = (doctest.ELLIPSIS | doctest.REPORT_ONLY_FIRST_FAILURE) class DoctestCase(unittest.TestCase): def __new__(self, test): return getattr(self, test)() @classmethod def test_tal(cls): from chameleon import tal return doctest.DocTestSuite( tal, optionflags=OPTIONFLAGS) @classmethod def test_tales(cls): from chameleon import tales return doctest.DocTestSuite( tales, optionflags=OPTIONFLAGS) @classmethod def test_utils(cls): from chameleon import utils return doctest.DocTestSuite( utils, optionflags=OPTIONFLAGS) @classmethod def test_exc(cls): from chameleon import exc return doctest.DocTestSuite( exc, optionflags=OPTIONFLAGS) @classmethod def test_compiler(cls): from chameleon import compiler return doctest.DocTestSuite( compiler, optionflags=OPTIONFLAGS) Chameleon-2.24/src/chameleon/tests/test_exc.py0000644000175000001440000000100412160052212022023 0ustar mborchusers00000000000000from unittest import TestCase class TestTemplateError(TestCase): def test_keep_token_location_info(self): # tokens should not lose information when passed to a TemplateError from chameleon import exc, tokenize, utils token = tokenize.Token('stuff', 5, 'more\nstuff', 'mystuff.txt') error = exc.TemplateError('message', token) s = str(error) self.assertTrue( '- Location: (line 2: col 0)' in s, 'No location data found\n%s' % s) Chameleon-2.24/src/chameleon/tests/test_loader.py0000644000175000001440000000723712034752421022541 0ustar mborchusers00000000000000import unittest class LoadTests: def _makeOne(self, search_path=None, **kwargs): klass = self._getTargetClass() return klass(search_path, **kwargs) def _getTargetClass(self): from chameleon.loader import TemplateLoader return TemplateLoader def test_load_relative(self): import os here = os.path.join(os.path.dirname(__file__), "inputs") loader = self._makeOne(search_path=[here]) result = self._load(loader, 'hello_world.pt') self.assertEqual(result.filename, os.path.join(here, 'hello_world.pt')) def test_consecutive_loads(self): import os here = os.path.join(os.path.dirname(__file__), "inputs") loader = self._makeOne(search_path=[here]) self.assertTrue( self._load(loader, 'hello_world.pt') is \ self._load(loader, 'hello_world.pt')) def test_load_relative_badpath_in_searchpath(self): import os here = os.path.join(os.path.dirname(__file__), "inputs") loader = self._makeOne(search_path=[os.path.join(here, 'none'), here]) result = self._load(loader, 'hello_world.pt') self.assertEqual(result.filename, os.path.join(here, 'hello_world.pt')) def test_load_abs(self): import os here = os.path.join(os.path.dirname(__file__), "inputs") loader = self._makeOne() abs = os.path.join(here, 'hello_world.pt') result = self._load(loader, abs) self.assertEqual(result.filename, abs) class LoadPageTests(unittest.TestCase, LoadTests): def _load(self, loader, filename): from chameleon.zpt import template return loader.load(filename, template.PageTemplateFile) class ModuleLoadTests(unittest.TestCase): def _makeOne(self, *args, **kwargs): from chameleon.loader import ModuleLoader return ModuleLoader(*args, **kwargs) def test_build(self): import tempfile path = tempfile.mkdtemp() loader = self._makeOne(path) source = "def function(): return %r" % "\xc3\xa6\xc3\xb8\xc3\xa5" try: source = source.decode('utf-8') except AttributeError: import sys self.assertTrue(sys.version_info[0] > 2) module = loader.build(source, "test.xml") result1 = module['function']() d = {} code = compile(source, 'test.py', 'exec') exec(code, d) result2 = d['function']() self.assertEqual(result1, result2) import os self.assertTrue("test.py" in os.listdir(path)) import shutil shutil.rmtree(path) class ZPTLoadTests(unittest.TestCase): def _makeOne(self, *args, **kwargs): import os here = os.path.join(os.path.dirname(__file__), "inputs") from chameleon.zpt import loader return loader.TemplateLoader(here, **kwargs) def test_load_xml(self): loader = self._makeOne() template = loader.load("hello_world.pt", "xml") from chameleon.zpt.template import PageTemplateFile self.assertTrue(isinstance(template, PageTemplateFile)) def test_load_text(self): loader = self._makeOne() template = loader.load("hello_world.txt", "text") from chameleon.zpt.template import PageTextTemplateFile self.assertTrue(isinstance(template, PageTextTemplateFile)) def test_load_getitem_gets_xml_file(self): loader = self._makeOne() template = loader["hello_world.pt"] from chameleon.zpt.template import PageTemplateFile self.assertTrue(isinstance(template, PageTemplateFile)) def test_suite(): import sys return unittest.findTestCases(sys.modules[__name__]) Chameleon-2.24/src/chameleon/tests/test_parser.py0000644000175000001440000000561111640111541022553 0ustar mborchusers00000000000000from __future__ import with_statement import sys from unittest import TestCase from ..namespaces import XML_NS from ..namespaces import XMLNS_NS from ..namespaces import PY_NS class ParserTest(TestCase): def test_sample_files(self): import os import traceback path = os.path.join(os.path.dirname(__file__), "inputs") for filename in os.listdir(path): if not filename.endswith('.html'): continue with open(os.path.join(path, filename), 'rb') as f: source = f.read() from ..utils import read_encoded try: want = read_encoded(source) except UnicodeDecodeError: exc = sys.exc_info()[1] self.fail("%s - %s" % (exc, filename)) from ..tokenize import iter_xml from ..parser import ElementParser try: tokens = iter_xml(want) parser = ElementParser(tokens, { 'xmlns': XMLNS_NS, 'xml': XML_NS, 'py': PY_NS, }) elements = tuple(parser) except: self.fail(traceback.format_exc()) output = [] def render(kind, args): if kind == 'element': # start tag tag, end, children = args output.append("%(prefix)s%(name)s" % tag) for attr in tag['attrs']: output.append( "%(space)s%(name)s%(eq)s%(quote)s%(value)s%(quote)s" % \ attr ) output.append("%(suffix)s" % tag) # children for item in children: render(*item) # end tag output.append( "%(prefix)s%(name)s%(space)s%(suffix)s" % end ) elif kind == 'text': text = args[0] output.append(text) elif kind == 'start_tag': node = args[0] output.append( "%(prefix)s%(name)s%(space)s%(suffix)s" % node ) else: raise RuntimeError("Not implemented: %s." % kind) for kind, args in elements: render(kind, args) got = "".join(output) from doctest import OutputChecker checker = OutputChecker() if checker.check_output(want, got, 0) is False: from doctest import Example example = Example(f.name, want) diff = checker.output_difference( example, got, 0) self.fail("(%s) - \n%s" % (f.name, diff)) Chameleon-2.24/src/chameleon/tests/test_sniffing.py0000644000175000001440000000763611640326377023112 0ustar mborchusers00000000000000from __future__ import with_statement import os import unittest import tempfile import shutil from chameleon.utils import unicode_string from chameleon.utils import encode_string class TypeSniffingTestCase(unittest.TestCase): def setUp(self): self.tempdir = tempfile.mkdtemp(prefix='chameleon-tests') def tearDown(self): shutil.rmtree(self.tempdir) def _get_temporary_file(self): filename = os.path.join(self.tempdir, 'template.py') assert not os.path.exists(filename) f = open(filename, 'w') f.flush() f.close() return filename def get_template(self, text): fn = self._get_temporary_file() with open(fn, 'wb') as tmpfile: tmpfile.write(text) from chameleon.template import BaseTemplateFile class DummyTemplateFile(BaseTemplateFile): def cook(self, body): self.body = body template = DummyTemplateFile(fn) template.cook_check() return template def check_content_type(self, text, expected_type): from chameleon.utils import read_bytes content_type = read_bytes(text, 'ascii')[2] self.assertEqual(content_type, expected_type) def test_xml_encoding(self): from chameleon.utils import xml_prefixes document1 = unicode_string( "" ) document2 = unicode_string( "" ) for bom, encoding in xml_prefixes: try: "".encode(encoding) except LookupError: # System does not support this encoding continue self.check_content_type(document1.encode(encoding), "text/xml") self.check_content_type(document2.encode(encoding), "text/xml") HTML_PUBLIC_ID = "-//W3C//DTD HTML 4.01 Transitional//EN" HTML_SYSTEM_ID = "http://www.w3.org/TR/html4/loose.dtd" # Couldn't find the code that handles this... yet. # def test_sniffer_html_ascii(self): # self.check_content_type( # "" # % self.HTML_SYSTEM_ID, # "text/html") # self.check_content_type( # "sample document", # "text/html") # TODO: This reflects a case that simply isn't handled by the # sniffer; there are many, but it gets it right more often than # before. def donttest_sniffer_xml_simple(self): self.check_content_type("", "text/xml") def test_html_default_encoding(self): body = encode_string( '' \ '\xc3\x90\xc2\xa2\xc3\x90\xc2\xb5' \ '\xc3\x91\xc2\x81\xc3\x91\xc2\x82' \ '') template = self.get_template(body) self.assertEqual(template.body, body.decode('utf-8')) def test_html_encoding_by_meta(self): body = encode_string( '' \ '\xc3\x92\xc3\xa5\xc3\xb1\xc3\xb2' \ '' \ "") template = self.get_template(body) self.assertEqual(template.body, body.decode('windows-1251')) def test_xhtml(self): body = encode_string( '' \ '\xc3\x92\xc3\xa5\xc3\xb1\xc3\xb2' \ '' \ "") template = self.get_template(body) self.assertEqual(template.body, body.decode('windows-1251')) def test_suite(): return unittest.makeSuite(TypeSniffingTestCase) if __name__ == "__main__": unittest.main(defaultTest="test_suite") Chameleon-2.24/src/chameleon/tests/test_templates.py0000644000175000000120000005434712614070165023234 0ustar mborchwheel00000000000000# -*- coding: utf-8 -*- from __future__ import with_statement import re import os import sys import shutil import tempfile from functools import wraps from functools import partial try: from unittest2 import TestCase except ImportError: from unittest import TestCase from chameleon.utils import byte_string from chameleon.exc import RenderError class Message(object): def __str__(self): return "message" class ImportTestCase(TestCase): def test_pagetemplates(self): from chameleon import PageTemplate from chameleon import PageTemplateFile from chameleon import PageTemplateLoader def test_pagetexttemplates(self): from chameleon import PageTextTemplate from chameleon import PageTextTemplateFile class TemplateFileTestCase(TestCase): @property def _class(self): from chameleon.template import BaseTemplateFile class TestTemplateFile(BaseTemplateFile): cook_count = 0 def cook(self, body): self.cook_count += 1 self._cooked = True return TestTemplateFile def setUp(self): self.tempdir = tempfile.mkdtemp(prefix='chameleon-tests') def tearDown(self): shutil.rmtree(self.tempdir) def _get_temporary_file(self): filename = os.path.join(self.tempdir, 'template.py') assert not os.path.exists(filename) f = open(filename, 'w') f.flush() f.close() return filename def test_cook_check(self): fn = self._get_temporary_file() template = self._class(fn) template.cook_check() self.assertEqual(template.cook_count, 1) def test_auto_reload(self): fn = self._get_temporary_file() # set time in past os.utime(fn, (0, 0)) template = self._class(fn, auto_reload=True) template.cook_check() # a second cook check makes no difference template.cook_check() self.assertEqual(template.cook_count, 1) # set current time on file os.utime(fn, None) # file is reloaded template.cook_check() self.assertEqual(template.cook_count, 2) def test_relative_is_expanded_to_cwd(self): template = self._class("___does_not_exist___") try: template.cook_check() except IOError: exc = sys.exc_info()[1] self.assertEqual( os.getcwd(), os.path.dirname(exc.filename) ) else: self.fail("Expected OSError.") class RenderTestCase(TestCase): root = os.path.dirname(__file__) def find_files(self, ext): inputs = os.path.join(self.root, "inputs") outputs = os.path.join(self.root, "outputs") for filename in sorted(os.listdir(inputs)): name, extension = os.path.splitext(filename) if extension != ext: continue path = os.path.join(inputs, filename) # if there's no output file, treat document as static and # expect intput equal to output import glob globbed = tuple(glob.iglob(os.path.join( outputs, "%s*%s" % (name.split('-', 1)[0], ext)))) if not globbed: self.fail("Missing output for: %s." % name) for output in globbed: name, ext = os.path.splitext(output) basename = os.path.basename(name) if '-' in basename: language = basename.split('-')[1] else: language = None yield path, output, language class ZopePageTemplatesTest(RenderTestCase): @property def from_string(body): from ..zpt.template import PageTemplate return partial(PageTemplate, keep_source=True) @property def from_file(body): from ..zpt.template import PageTemplateFile return partial(PageTemplateFile, keep_source=True) def template(body): def decorator(func): @wraps(func) def wrapper(self): template = self.from_string(body) return func(self, template) return wrapper return decorator def error(body): def decorator(func): @wraps(func) def wrapper(self): from chameleon.exc import TemplateError try: template = self.from_string(body) except TemplateError: exc = sys.exc_info()[1] return func(self, body, exc) else: self.fail("Expected exception.") return wrapper return decorator def test_syntax_error_in_strict_mode(self): from chameleon.exc import ExpressionError self.assertRaises( ExpressionError, self.from_string, """""", strict=True ) def test_syntax_error_in_non_strict_mode(self): from chameleon.exc import ExpressionError body = """""" template = self.from_string(body, strict=False) try: template() except ExpressionError: exc = sys.exc_info()[1] self.assertTrue(body[exc.offset:].startswith('bad ///')) else: self.fail("Expected exception") @error("""""") def test_attributes_on_tal_tag_fails(self, body, exc): self.assertTrue(body[exc.offset:].startswith('dummy')) @error("""""") def test_i18n_attributes_with_non_identifiers(self, body, exc): self.assertTrue(body[exc.offset:].startswith('foo,')) @error("""""") def test_repeat_syntax_error_message(self, body, exc): self.assertTrue(body[exc.offset:].startswith('key,value')) @error('''

''') def test_repeat_i18n_name_error(self, body, exc): self.assertTrue(body[exc.offset:].startswith('repeat'), body[exc.offset:]) @error(''' ''') def test_i18n_name_not_in_translation_error(self, body, exc): self.assertTrue(body[exc.offset:].startswith('not_in_translation')) def test_encoded(self): filename = '074-encoded-template.pt' with open(os.path.join(self.root, 'inputs', filename), 'rb') as f: body = f.read() self.from_string(body) def test_utf8_encoded(self): filename = '073-utf8-encoded.pt' with open(os.path.join(self.root, 'inputs', filename), 'rb') as f: body = f.read() self.from_string(body) def test_unicode_decode_error(self): template = self.from_file( os.path.join(self.root, 'inputs', 'greeting.pt') ) string = native = "the artist formerly known as ƤŗíƞĆě" try: string = string.decode('utf-8') except AttributeError: pass class name: @staticmethod def __html__(): # This raises a decoding exception string.encode('utf-8').decode('ascii') self.fail("Expected exception raised.") try: template(name=name) except UnicodeDecodeError: exc = sys.exc_info()[1] formatted = str(exc) # There's a marker under the expression that has the # unicode decode error self.assertTrue('^^^^^' in formatted) self.assertTrue(native in formatted) else: self.fail("expected error") def test_custom_encoding_for_str_or_bytes_in_content(self): string = '
ТеÑÑ‚${text}
' try: string = string.decode('utf-8') except AttributeError: pass template = self.from_string(string, encoding="windows-1251") text = 'ТеÑÑ‚' try: text = text.decode('utf-8') except AttributeError: pass rendered = template(text=text.encode('windows-1251')) self.assertEqual( rendered, string.replace('${text}', text) ) def test_custom_encoding_for_str_or_bytes_in_attributes(self): string = '' try: string = string.decode('utf-8') except AttributeError: pass template = self.from_string(string, encoding="windows-1251") text = 'ТеÑÑ‚' try: text = text.decode('utf-8') except AttributeError: pass rendered = template(text=text.encode('windows-1251')) self.assertEqual( rendered, string.replace('${text}', text) ) def test_null_translate_function(self): template = self.from_string('${test}', translate=None) rendered = template(test=object()) self.assertTrue('object' in rendered) def test_object_substitution_coerce_to_str(self): template = self.from_string('${test}', translate=None) class dummy(object): def __repr__(inst): self.fail("call not expected") def __str__(inst): return '' rendered = template(test=dummy()) self.assertEqual(rendered, '<dummy>') def test_repr(self): template = self.from_file( os.path.join(self.root, 'inputs', 'hello_world.pt') ) self.assertTrue(template.filename in repr(template)) def test_underscore_variable(self): template = self.from_string( "
${_dummy}
" ) self.assertTrue(template(), "
foo
") def test_trim_attribute_space(self): document = '''
''' result1 = self.from_string( document)() result2 = self.from_string( document, trim_attribute_space=True)() self.assertEqual(result1.count(" "), 49) self.assertEqual(result2.count(" "), 4) self.assertTrue(" />" in result1) self.assertTrue(" />" in result2) def test_exception(self): from traceback import format_exception_only template = self.from_string( "
${dummy}
" ) try: template() except Exception as exc: self.assertIn(RenderError, type(exc).__bases__) exc = sys.exc_info()[1] formatted = str(exc) self.assertFalse('NameError:' in formatted) self.assertTrue('foo' in formatted) self.assertTrue('(line 1: col 23)' in formatted) formatted_exc = "\n".join(format_exception_only(type(exc), exc)) self.assertTrue('NameError: foo' in formatted_exc) else: self.fail("expected error") def test_create_formatted_exception(self): from chameleon.utils import create_formatted_exception exc = create_formatted_exception(NameError('foo'), NameError, str) self.assertEqual(exc.args, ('foo', )) class MyNameError(NameError): def __init__(self, boo): NameError.__init__(self, boo) self.bar = boo exc = create_formatted_exception(MyNameError('foo'), MyNameError, str) self.assertEqual(exc.args, ('foo', )) self.assertEqual(exc.bar, 'foo') def test_create_formatted_exception_no_subclass(self): from chameleon.utils import create_formatted_exception class DifficultMetaClass(type): def __init__(self, class_name, bases, namespace): if not bases == (BaseException, ): raise TypeError(bases) Difficult = DifficultMetaClass('Difficult', (BaseException, ), {'args': ()}) exc = create_formatted_exception(Difficult(), Difficult, str) self.assertEqual(exc.args, ()) def test_error_handler_makes_safe_copy(self): calls = [] class TestException(Exception): def __init__(self, *args, **kwargs): calls.append((args, kwargs)) def _render(stream, econtext, rcontext): exc = TestException('foo', bar='baz') rcontext['__error__'] = ('expression', 1, 42, 'test.pt', exc), raise exc template = self.from_string("") template._render = _render try: template() except TestException: self.assertEqual(calls, [(('foo', ), {'bar': 'baz'})]) exc = sys.exc_info()[1] formatted = str(exc) self.assertTrue('TestException' in formatted) self.assertTrue('"expression"' in formatted) self.assertTrue('(line 1: col 42)' in formatted) else: self.fail("unexpected error") def test_double_underscore_variable(self): from chameleon.exc import TranslationError self.assertRaises( TranslationError, self.from_string, "
${__dummy}
", ) def test_compiler_internals_are_disallowed(self): from chameleon.compiler import COMPILER_INTERNALS_OR_DISALLOWED from chameleon.exc import TranslationError for name in COMPILER_INTERNALS_OR_DISALLOWED: body = "${%s}" % (name, name) self.assertRaises(TranslationError, self.from_string, body) def test_simple_translate_mapping(self): template = self.from_string( '
' 'foo' '
') self.assertEqual(template(), '
foo
') def test_translate_is_not_an_internal(self): macro = self.from_string('bar') template = self.from_string( ''' foo ''') result = template(macro=macro) self.assertTrue('foo' in result) self.assertTrue('foo' in result) def test_literal_false(self): template = self.from_string( '' '' '' '', literal_false=True, ) self.assertEqual( template(), '' '' '' '', template.source ) def test_boolean_attributes(self): template = self.from_string( '' '' '' '' '' '', boolean_attributes=set(['checked']) ) self.assertEqual( template(), '' '' '' '' '' '', template.source ) def test_default_debug_flag(self): from chameleon.config import DEBUG_MODE template = self.from_file( os.path.join(self.root, 'inputs', 'hello_world.pt'), ) self.assertEqual(template.debug, DEBUG_MODE) self.assertTrue('debug' not in template.__dict__) def test_debug_flag_on_string(self): from chameleon.loader import ModuleLoader with open(os.path.join(self.root, 'inputs', 'hello_world.pt')) as f: source = f.read() template = self.from_string(source, debug=True) self.assertTrue(template.debug) self.assertTrue(isinstance(template.loader, ModuleLoader)) def test_debug_flag_on_file(self): from chameleon.loader import ModuleLoader template = self.from_file( os.path.join(self.root, 'inputs', 'hello_world.pt'), debug=True, ) self.assertTrue(template.debug) self.assertTrue(isinstance(template.loader, ModuleLoader)) def test_tag_mismatch(self): from chameleon.exc import ParseError try: self.from_string("""
""") except ParseError: exc = sys.exc_info()[1] self.assertTrue("" in str(exc)) else: self.fail("Expected error.") class ZopeTemplatesTestSuite(RenderTestCase): def setUp(self): self.temp_path = temp_path = tempfile.mkdtemp() @self.addCleanup def cleanup(path=temp_path): shutil.rmtree(path) def test_pt_files(self): from ..zpt.template import PageTemplateFile class Literal(object): def __init__(self, s): self.s = s def __html__(self): return self.s def __str__(self): raise RuntimeError( "%r is a literal." % self.s) from chameleon.loader import TemplateLoader loader = TemplateLoader(os.path.join(self.root, "inputs")) self.execute( ".pt", PageTemplateFile, literal=Literal("
Hello world!
"), content="
Hello world!
", message=Message(), load=loader.bind(PageTemplateFile), ) def test_txt_files(self): from ..zpt.template import PageTextTemplateFile self.execute(".txt", PageTextTemplateFile) def execute(self, ext, factory, **kwargs): def translate(msgid, domain=None, mapping=None, context=None, target_language=None, default=None): if default is None: default = str(msgid) if isinstance(msgid, Message): default = "Message" if mapping: default = re.sub(r'\${([a-z_]+)}', r'%(\1)s', default) % \ mapping if target_language is None: return default if domain is None: with_domain = "" else: with_domain = " with domain '%s'" % domain if context is None: with_context = "" else: with_context = ", context '%s'" % context stripped = default.rstrip('\n ') return "%s ('%s' translation into '%s'%s%s)%s" % ( stripped, msgid, target_language, with_domain, with_context, default[len(stripped):] ) for input_path, output_path, language in self.find_files(ext): # Make friendly title so we can locate the generated # source when debugging self.shortDescription = lambda: input_path # When input path contaiins the string 'implicit-i18n', we # enable "implicit translation". implicit_i18n = 'implicit-i18n' in input_path implicit_i18n_attrs = ("alt", "title") if implicit_i18n else () enable_data_attributes = 'data-attributes' in input_path template = factory( input_path, keep_source=True, strict=False, implicit_i18n_translate=implicit_i18n, implicit_i18n_attributes=implicit_i18n_attrs, enable_data_attributes=enable_data_attributes, ) params = kwargs.copy() params.update({ 'translate': translate, 'target_language': language, }) template.cook_check() try: got = template.render(**params) except: import traceback e = traceback.format_exc() self.fail("%s\n\n Example source:\n\n%s" % (e, "\n".join( ["%#03.d%s" % (lineno + 1, line and " " + line or "") for (lineno, line) in enumerate(template.source.split( '\n'))]))) if isinstance(got, byte_string): got = got.decode('utf-8') from doctest import OutputChecker checker = OutputChecker() if not os.path.exists(output_path): output = template.body else: with open(output_path, 'rb') as f: output = f.read() from chameleon.utils import read_xml_encoding from chameleon.utils import detect_encoding if template.content_type == 'text/xml': encoding = read_xml_encoding(output) or \ template.default_encoding else: content_type, encoding = detect_encoding( output, template.default_encoding) want = output.decode(encoding) if checker.check_output(want, got, 0) is False: from doctest import Example example = Example(input_path, want) diff = checker.output_difference( example, got, 0) self.fail("(%s) - \n%s\n\nCode:\n%s" % ( input_path, diff.rstrip('\n'), template.source.encode('utf-8'))) Chameleon-2.24/src/chameleon/tests/test_tokenizer.py0000644000175000001440000000270211640107101023264 0ustar mborchusers00000000000000import sys from unittest import TestCase class TokenizerTest(TestCase): def test_sample_files(self): import os import traceback path = os.path.join(os.path.dirname(__file__), "inputs") for filename in os.listdir(path): if not filename.endswith('.xml'): continue f = open(os.path.join(path, filename), 'rb') source = f.read() f.close() from ..utils import read_encoded try: want = read_encoded(source) except UnicodeDecodeError: exc = sys.exc_info()[1] self.fail("%s - %s" % (exc, filename)) from ..tokenize import iter_xml try: tokens = iter_xml(want) got = "".join(tokens) except: self.fail(traceback.format_exc()) from doctest import OutputChecker checker = OutputChecker() if checker.check_output(want, got, 0) is False: from doctest import Example example = Example(f.name, want) diff = checker.output_difference( example, got, 0) self.fail("(%s) - \n%s" % (f.name, diff)) def test_token(self): from chameleon.tokenize import Token token = Token("abc", 1) self.assertTrue(isinstance(token[1:], Token)) self.assertEqual(token[1:].pos, 2) Chameleon-2.24/src/chameleon/zpt/0000755000175000000120000000000012614070273017263 5ustar mborchwheel00000000000000Chameleon-2.24/src/chameleon/zpt/__init__.py0000644000175000001440000000000211445675021021432 0ustar mborchusers00000000000000# Chameleon-2.24/src/chameleon/zpt/loader.py0000644000175000001440000000151211622464526021153 0ustar mborchusers00000000000000from chameleon.loader import TemplateLoader as BaseLoader from chameleon.zpt import template class TemplateLoader(BaseLoader): formats = { "xml": template.PageTemplateFile, "text": template.PageTextTemplateFile, } default_format = "xml" def __init__(self, *args, **kwargs): formats = kwargs.pop('formats', None) if formats is not None: self.formats = formats super(TemplateLoader, self).__init__(*args, **kwargs) def load(self, filename, format=None): """Load and return a template file. The format parameter determines will parse the file. Valid options are `xml` and `text`. """ cls = self.formats[format or self.default_format] return super(TemplateLoader, self).load(filename, cls) __getitem__ = load Chameleon-2.24/src/chameleon/zpt/program.py0000644000175000000120000006127212614070165021314 0ustar mborchwheel00000000000000import re try: import ast except ImportError: from chameleon import ast25 as ast try: str = unicode except NameError: long = int from functools import partial from copy import copy from ..program import ElementProgram from ..namespaces import XML_NS from ..namespaces import XMLNS_NS from ..namespaces import I18N_NS as I18N from ..namespaces import TAL_NS as TAL from ..namespaces import METAL_NS as METAL from ..namespaces import META_NS as META from ..astutil import Static from ..astutil import parse from ..astutil import marker from .. import tal from .. import metal from .. import i18n from .. import nodes from ..exc import LanguageError from ..exc import ParseError from ..exc import CompilationError from ..utils import decode_htmlentities try: str = unicode except NameError: long = int missing = object() re_trim = re.compile(r'($\s+|\s+^)', re.MULTILINE) EMPTY_DICT = Static(ast.Dict(keys=[], values=[])) def skip(node): return node def wrap(node, *wrappers): for wrapper in reversed(wrappers): node = wrapper(node) return node def validate_attributes(attributes, namespace, whitelist): for ns, name in attributes: if ns == namespace and name not in whitelist: raise CompilationError( "Bad attribute for namespace '%s'" % ns, name ) def convert_data_attributes(ns_attrs, attrs, namespaces): d = 0 for i, attr in list(enumerate(attrs)): name = attr['name'] if name.startswith('data-'): name = name[5:] if '-' not in name: continue prefix, name = name.split('-', 1) ns_attrs[namespaces[prefix], name] = attr['value'] attrs.pop(i - d) d += 1 class MacroProgram(ElementProgram): """Visitor class that generates a program for the ZPT language.""" DEFAULT_NAMESPACES = { 'xmlns': XMLNS_NS, 'xml': XML_NS, 'tal': TAL, 'metal': METAL, 'i18n': I18N, 'meta': META, } DROP_NS = TAL, METAL, I18N, META VARIABLE_BLACKLIST = "default", "repeat", "nothing", \ "convert", "decode", "translate" _interpolation_enabled = True _whitespace = "\n" _last = "" # Macro name (always trivial for a macro program) name = None # This default marker value has the semantics that if an # expression evaluates to that value, the expression default value # is returned. For an attribute, if there is no default, this # means that the attribute is dropped. default_marker = None # Escape mode (true value means XML-escape) escape = True # Attributes which should have boolean behavior (on true, the # value takes the attribute name, on false, the attribute is # dropped) boolean_attributes = set() # If provided, this should be a set of attributes for implicit # translation. Any attribute whose name is included in the set # will be translated even without explicit markup. Note that all # values should be lowercase strings. implicit_i18n_attributes = set() # If set, text will be translated even without explicit markup. implicit_i18n_translate = False # If set, additional attribute whitespace will be stripped. trim_attribute_space = False # If set, data attributes can be used instead of namespace # attributes, e.g. "data-tal-content" instead of "tal:content". enable_data_attributes = False def __init__(self, *args, **kwargs): # Internal array for switch statements self._switches = [] # Internal array for current use macro level self._use_macro = [] # Internal array for current interpolation status self._interpolation = [True] # Internal dictionary of macro definitions self._macros = {} # Apply default values from **kwargs to self self._pop_defaults( kwargs, 'boolean_attributes', 'default_marker', 'escape', 'implicit_i18n_translate', 'implicit_i18n_attributes', 'trim_attribute_space', 'enable_data_attributes', ) super(MacroProgram, self).__init__(*args, **kwargs) @property def macros(self): macros = list(self._macros.items()) macros.append((None, nodes.Sequence(self.body))) return tuple( nodes.Macro(name, [nodes.Context(node)]) for name, node in macros ) def visit_default(self, node): return nodes.Text(node) def visit_element(self, start, end, children): ns = start['ns_attrs'] attrs = start['attrs'] if self.enable_data_attributes: attrs = list(attrs) convert_data_attributes(ns, attrs, start['ns_map']) for (prefix, attr), encoded in tuple(ns.items()): if prefix == TAL: ns[prefix, attr] = decode_htmlentities(encoded) # Validate namespace attributes validate_attributes(ns, TAL, tal.WHITELIST) validate_attributes(ns, METAL, metal.WHITELIST) validate_attributes(ns, I18N, i18n.WHITELIST) # Check attributes for language errors self._check_attributes(start['namespace'], ns) # Remember whitespace for item repetition if self._last is not None: self._whitespace = "\n" + " " * len(self._last.rsplit('\n', 1)[-1]) # Set element-local whitespace whitespace = self._whitespace # Set up switch try: clause = ns[TAL, 'switch'] except KeyError: switch = None else: value = nodes.Value(clause) switch = value, nodes.Copy(value) self._switches.append(switch) body = [] # Include macro use_macro = ns.get((METAL, 'use-macro')) extend_macro = ns.get((METAL, 'extend-macro')) if use_macro or extend_macro: omit = True slots = [] self._use_macro.append(slots) if use_macro: inner = nodes.UseExternalMacro( nodes.Value(use_macro), slots, False ) else: inner = nodes.UseExternalMacro( nodes.Value(extend_macro), slots, True ) # -or- include tag else: content = nodes.Sequence(body) # tal:content try: clause = ns[TAL, 'content'] except KeyError: pass else: key, value = tal.parse_substitution(clause) xlate = True if ns.get((I18N, 'translate')) == '' else False content = self._make_content_node(value, content, key, xlate) if end is None: # Make sure start-tag has opening suffix. start['suffix'] = ">" # Explicitly set end-tag. end = { 'prefix': '' } # i18n:translate try: clause = ns[I18N, 'translate'] except KeyError: pass else: dynamic = ns.get((TAL, 'content')) or ns.get((TAL, 'replace')) if not dynamic: content = nodes.Translate(clause, content) # tal:attributes try: clause = ns[TAL, 'attributes'] except KeyError: TAL_ATTRIBUTES = [] else: TAL_ATTRIBUTES = tal.parse_attributes(clause) # i18n:attributes try: clause = ns[I18N, 'attributes'] except KeyError: I18N_ATTRIBUTES = {} else: I18N_ATTRIBUTES = i18n.parse_attributes(clause) # Prepare attributes from TAL language prepared = tal.prepare_attributes( attrs, TAL_ATTRIBUTES, I18N_ATTRIBUTES, ns, self.DROP_NS ) # Create attribute nodes STATIC_ATTRIBUTES = self._create_static_attributes(prepared) ATTRIBUTES = self._create_attributes_nodes( prepared, I18N_ATTRIBUTES, STATIC_ATTRIBUTES ) # Start- and end nodes start_tag = nodes.Start( start['name'], self._maybe_trim(start['prefix']), self._maybe_trim(start['suffix']), ATTRIBUTES ) end_tag = nodes.End( end['name'], end['space'], self._maybe_trim(end['prefix']), self._maybe_trim(end['suffix']), ) if end is not None else None # tal:omit-tag try: clause = ns[TAL, 'omit-tag'] except KeyError: omit = False else: clause = clause.strip() if clause == "": omit = True else: expression = nodes.Negate(nodes.Value(clause)) omit = expression # Wrap start- and end-tags in condition start_tag = nodes.Condition(expression, start_tag) if end_tag is not None: end_tag = nodes.Condition(expression, end_tag) if omit is True or start['namespace'] in self.DROP_NS: inner = content else: inner = nodes.Element( start_tag, end_tag, content, ) # Assign static attributes dictionary to "attrs" value inner = nodes.Define( [nodes.Alias(["attrs"], STATIC_ATTRIBUTES or EMPTY_DICT)], inner, ) if omit is not False: inner = nodes.Cache([omit], inner) # tal:replace try: clause = ns[TAL, 'replace'] except KeyError: pass else: key, value = tal.parse_substitution(clause) xlate = True if ns.get((I18N, 'translate')) == '' else False inner = self._make_content_node(value, inner, key, xlate) # metal:define-slot try: clause = ns[METAL, 'define-slot'] except KeyError: DEFINE_SLOT = skip else: DEFINE_SLOT = partial(nodes.DefineSlot, clause) # tal:define try: clause = ns[TAL, 'define'] except KeyError: DEFINE = skip else: defines = tal.parse_defines(clause) if defines is None: raise ParseError("Invalid define syntax.", clause) DEFINE = partial( nodes.Define, [nodes.Assignment( names, nodes.Value(expr), context == "local") for (context, names, expr) in defines], ) # tal:case try: clause = ns[TAL, 'case'] except KeyError: CASE = skip else: value = nodes.Value(clause) for switch in reversed(self._switches): if switch is not None: break else: raise LanguageError( "Must define switch on a parent element.", clause ) CASE = lambda node: nodes.Define( [nodes.Alias(["default"], switch[1], False)], nodes.Condition( nodes.Equality(switch[0], value), nodes.Cancel([switch[0]], node), )) # tal:repeat try: clause = ns[TAL, 'repeat'] except KeyError: REPEAT = skip else: defines = tal.parse_defines(clause) assert len(defines) == 1 context, names, expr = defines[0] expression = nodes.Value(expr) if start['namespace'] == TAL: self._last = None self._whitespace = whitespace.lstrip('\n') whitespace = "" REPEAT = partial( nodes.Repeat, names, expression, context == "local", whitespace ) # tal:condition try: clause = ns[TAL, 'condition'] except KeyError: CONDITION = skip else: expression = nodes.Value(clause) CONDITION = partial(nodes.Condition, expression) # tal:switch if switch is None: SWITCH = skip else: SWITCH = partial(nodes.Cache, list(switch)) # i18n:domain try: clause = ns[I18N, 'domain'] except KeyError: DOMAIN = skip else: DOMAIN = partial(nodes.Domain, clause) # i18n:context try: clause = ns[I18N, 'context'] except KeyError: CONTEXT = skip else: CONTEXT = partial(nodes.TxContext, clause) # i18n:name try: clause = ns[I18N, 'name'] except KeyError: NAME = skip else: if not clause.strip(): NAME = skip else: NAME = partial(nodes.Name, clause) # The "slot" node next is the first node level that can serve # as a macro slot slot = wrap( inner, DEFINE_SLOT, DEFINE, CASE, CONDITION, REPEAT, SWITCH, DOMAIN, CONTEXT, ) # metal:fill-slot try: clause = ns[METAL, 'fill-slot'] except KeyError: pass else: if not clause.strip(): raise LanguageError( "Must provide a non-trivial string for metal:fill-slot.", clause ) index = -(1 + int(bool(use_macro or extend_macro))) try: slots = self._use_macro[index] except IndexError: raise LanguageError( "Cannot use metal:fill-slot without metal:use-macro.", clause ) slots = self._use_macro[index] slots.append(nodes.FillSlot(clause, slot)) # metal:define-macro try: clause = ns[METAL, 'define-macro'] except KeyError: pass else: self._macros[clause] = slot slot = nodes.UseInternalMacro(clause) slot = wrap( slot, NAME ) # tal:on-error try: clause = ns[TAL, 'on-error'] except KeyError: ON_ERROR = skip else: key, value = tal.parse_substitution(clause) translate = True if ns.get((I18N, 'translate')) == '' else False fallback = self._make_content_node(value, None, key, translate) if omit is False and start['namespace'] not in self.DROP_NS: start_tag = copy(start_tag) start_tag.attributes = nodes.Sequence( start_tag.attributes.extract( lambda attribute: isinstance(attribute, nodes.Attribute) and isinstance(attribute.expression, ast.Str) ) ) if end_tag is None: # Make sure start-tag has opening suffix. We don't # allow self-closing element here. start_tag.suffix = ">" # Explicitly set end-tag. end_tag = nodes.End(start_tag.name, '', '',) fallback = nodes.Element( start_tag, end_tag, fallback, ) ON_ERROR = partial(nodes.OnError, fallback, 'error') clause = ns.get((META, 'interpolation')) if clause in ('false', 'off'): INTERPOLATION = False elif clause in ('true', 'on'): INTERPOLATION = True elif clause is None: INTERPOLATION = self._interpolation[-1] else: raise LanguageError("Bad interpolation setting.", clause) self._interpolation.append(INTERPOLATION) # Visit content body for child in children: body.append(self.visit(*child)) self._switches.pop() self._interpolation.pop() if use_macro: self._use_macro.pop() return wrap( slot, ON_ERROR ) def visit_start_tag(self, start): return self.visit_element(start, None, []) def visit_cdata(self, node): if not self._interpolation[-1] or not '${' in node: return nodes.Text(node) expr = nodes.Substitution(node, ()) return nodes.Interpolation(expr, True, False) def visit_comment(self, node): if node.startswith('$', re.DOTALL) match_cdata = re.compile( r'^.*)\]>$', re.DOTALL) match_declaration = re.compile( r'^[^>]+)>$', re.DOTALL) match_processing_instruction = re.compile( r'^<\?(?P\w+)(?P.*?)\?>', re.DOTALL) match_xml_declaration = re.compile(r'^<\?xml(?=[ /])', re.DOTALL) log = logging.getLogger('chameleon.parser') def substitute(regex, repl, token): if not isinstance(token, Token): token = Token(token) return Token( regex.sub(repl, token), token.pos, token.source, token.filename ) def groups(m, token): result = [] for i, group in enumerate(m.groups()): if group is not None: j, k = m.span(i + 1) group = token[j:k] result.append(group) return tuple(result) def groupdict(m, token): d = m.groupdict() for name, value in d.items(): if value is not None: i, j = m.span(name) d[name] = token[i:j] return d def match_tag(token, regex=match_tag_prefix_and_name): m = regex.match(token) d = groupdict(m, token) end = m.end() token = token[end:] attrs = d['attrs'] = [] for m in match_single_attribute.finditer(token): attr = groupdict(m, token) alt_value = attr.pop('alt_value', None) if alt_value is not None: attr['value'] = alt_value attr['quote'] = '' simple_value = attr.pop('simple_value', None) if simple_value is not None: attr['quote'] = '' attr['value'] = '' attr['eq'] = '' attrs.append(attr) d['suffix'] = token[m.end():] return d def parse_tag(token, namespace): node = match_tag(token) update_namespace(node['attrs'], namespace) if ':' in node['name']: prefix = node['name'].split(':')[0] else: prefix = None default = node['namespace'] = namespace.get(prefix, XML_NS) node['ns_attrs'] = unpack_attributes( node['attrs'], namespace, default ) node['ns_map'] = namespace return node def update_namespace(attributes, namespace): # possibly update namespaces; we do this in a separate step # because this assignment is irrespective of order for attribute in attributes: name = attribute['name'] value = attribute['value'] if name == 'xmlns': namespace[None] = value elif name.startswith('xmlns:'): namespace[name[6:]] = value def unpack_attributes(attributes, namespace, default): namespaced = OrderedDict() for index, attribute in enumerate(attributes): name = attribute['name'] value = attribute['value'] if ':' in name: prefix = name.split(':')[0] name = name[len(prefix) + 1:] try: ns = namespace[prefix] except KeyError: raise KeyError( "Undefined namespace prefix: %s." % prefix) else: ns = default namespaced[ns, name] = value return namespaced def identify(string): if string.startswith("<"): if string.startswith(" Note that the initial question mark character (?) will be omitted from output. - The parser now accepts '<' and '>' in attributes. Note that this is invalid markup. Previously, the '<' would not be accepted as a valid attribute value, but this would result in an 'unexpected end tag' error elsewhere. This fixes issue #38. - The expression compiler now provides methods ``assign_text`` and ``assign_value`` such that a template engine might configure this value conversion to support e.g. encoded strings. Note that currently, the only client for the ``assign_text`` method is the string expression type. - Enable template loader for string-based template classes. Note that the ``filename`` keyword argument may be provided on initialization to identify the template source by filename. This fixes issue #36. - Added ``extra_builtins`` option to the page template class. These builtins are added to the default builtins dictionary at cook time and may be provided at initialization using the ``extra_builtins`` keyword argument. Bugfixes: - If a translation domain is set for a fill slot, use this setting instead of the macro template domain. - The Python expression compiler now correctly decodes HTML entities ``'gt'`` and ``'lt'``. This fixes issue #32. - The string expression compiler now correctly handles encoded text (when support for encoded strings is enabled). This fixes issue #35. - Fixed an issue where setting the ``filename`` attribute on a file-based template would not automatically cause an invalidation. - Exceptions raised by Chameleon can now be copied via ``copy.copy``. This fixes issue #36. [leorochael] - If copying the exception fails in the exception handler, simply re-raise the original exception and log a warning. 2.2 (2011-07-28) ---------------- Features: - Added new expression type ``load:`` that allows loading a template. Both relative and absolute paths are supported. If the path given is relative, then it will be resolved with respect to the directory of the template. - Added support for dynamic evaluation of expressions. Note that this is to support legacy applications. It is not currently wired into the provided template classes. - Template classes now have a ``builtins`` attribute which may be used to define built-in variables always available in the template variable scope. Incompatibilities: - The file-based template class no longer accepts a parameter ``loader``. This parameter would be used to load a template from a relative path, using a ``find(filename)`` method. This was however, undocumented, and probably not very useful since we have the ``TemplateLoader`` mechanism already. - The compiled template module now contains an ``initialize`` function which takes values that map to the template builtins. The return value of this function is a dictionary that contains the render functions. Bugfixes: - The file-based template class no longer verifies the existance of a template file (using ``os.lstat``). This now happens implicitly if eager parsing is enabled, or otherwise when first needed (e.g. at render time). This is classified as a bug fix because the previous behavior was probably not what you'd expect, especially if an application initializes a lot of templates without needing to render them immediately. 2.1.1 (2011-07-28) ------------------ Features: - Improved exception display. The expression string is now shown in the context of the original source (if available) with a marker string indicating the location of the expression in the template source. Bugfixes: - The ``structure`` insertion mode now correctly decodes entities for any expression type (including ``string:``). This fixes issue #30. - Don't show internal variables in the exception formatter variable listing. 2.1 (2011-07-25) ---------------- Features: - Expression interpolation (using the ``${...}`` operator and previously also ``$identifier``) now requires braces everywhere except inside the ``string:`` expression type. This change is motivated by a number of legacy templates in which the interpolation format without braces ``$identifier`` appears as text. 2.0.2 (2011-07-25) ------------------ Bugfixes: - Don't use dynamic variable scope for lambda-scoped variables (#27). - Avoid duplication of exception class and message in traceback. - Fixed issue where a ``metal:fill-slot`` would be ignored if a macro was set to be used on the same element (#16). 2.0.1 (2011-07-23) ------------------ Bugfixes: - Fixed issue where global variable definition from macro slots would fail (they would instead be local). This also affects error reporting from inside slots because this would be recorded internally as a global. - Fixed issue with template cache digest (used for filenames); modules are now invalidated whenever any changes are made to the distribution set available (packages on ``sys.path``). - Fixed exception handler to better let exceptions propagate through the renderer. - The disk-based module compiler now mangles template source filenames such that the output Python module is valid and at root level (dots and hyphens are replaced by an underscore). This fixes issue #17. - Fixed translations (i18n) on Python 2.5. 2.0 (2011-07-14) ---------------- - Point release. 2.0-rc14 (2011-07-13) --------------------- Bugfixes: - The tab character (``\t``) is now parsed correctly when used inside tags. Features: - The ``RepeatDict`` class now works as a proxy behind a seperate dictionary instance. - Added template constructor option ``keep_body`` which is a flag (also available as a class attribute) that controls whether to save the template body input in the ``body`` attribute. This is disabled by default, unless debug-mode is enabled. - The page template loader class now accepts an optional ``formats`` argument which can be used to select an alternative template class. 2.0-rc13 (2011-07-07) --------------------- Bugfixes: - The backslash character (followed by optional whitespace and a line break) was not correctly interpreted as a continuation for Python expressions. Features: - The Python expression implementation is now more flexible for external subclassing via a new ``parse`` method. 2.0-rc12 (2011-07-04) --------------------- Bugfixes: - Initial keyword arguments passed to a template now no longer "leak" into the template variable space after a macro call. - An unexpected end tag is now an unrecoverable error. Features: - Improve exception output. 2.0-rc11 (2011-05-26) --------------------- Bugfixes: - Fixed issue where variable names that begin with an underscore were seemingly allowed, but their use resulted in a compiler error. Features: - Template variable names are now allowed to be prefixed with a single underscore, but not two or more (reserved for internal use). Examples of valid names:: item ITEM _item camelCase underscore_delimited help - Added support for Genshi's comment "drop" syntax:: Note the additional exclamation (!) character. This fixes addresses issue #10. 2.0-rc10 (2011-05-24) --------------------- Bugfixes: - The ``tal:attributes`` statement now correctly operates case-insensitive. The attribute name given in the statement will replace an existing attribute with the same name, without respect to case. Features: - Added ``meta:interpolation`` statement to control expression interpolation setting. Strings that disable the setting: ``"off"`` and ``"false"``. Strings that enable the setting: ``"on"`` and ``"true"``. - Expression interpolation now works inside XML comments. 2.0-rc9 (2011-05-05) -------------------- Features: - Better debugging support for string decode and conversion. If a naive join fails, each element in the output will now be attempted coerced to unicode to try and trigger the failure near to the bad string. 2.0-rc8 (2011-04-11) -------------------- Bugfixes: - If a macro defines two slots with the same name, a caller will now fill both with a single usage. - If a valid of ``None`` is provided as the translation function argument, we now fall back to the class default. 2.0-rc7 (2011-03-29) -------------------- Bugfixes: - Fixed issue with Python 2.5 compatibility AST. This affected at least PyPy 1.4. Features: - The ``auto_reload`` setting now defaults to the class value; the base template class gives a default value of ``chameleon.config.AUTO_RELOAD``. This change allows a subclass to provide a custom default value (such as an application-specific debug mode setting). 2.0-rc6 (2011-03-19) -------------------- Features: - Added support for ``target_language`` keyword argument to render method. If provided, the argument will be curried onto the translation function. Bugfixes: - The HTML entities 'lt', 'gt' and 'quot' appearing inside content subtition expressions are now translated into their native character values. This fixes an issue where you could not dynamically create elements using the ``structure`` (which is possible in ZPT). The need to create such structure stems from the lack of an expression interpolation operator in ZPT. - Fixed duplicate file pointer issue with test suite (affected Windows platforms only). This fixes issue #9. [oliora] - Use already open file using ``os.fdopen`` when trying to write out the module source. This fixes LP #731803. 2.0-rc5 (2011-03-07) -------------------- Bugfixes: - Fixed a number of issues concerning the escaping of attribute values: 1) Static attribute values are now included as they appear in the source. This means that invalid attribute values such as ``"true && false"`` are now left alone. It's not the job of the template engine to correct such markup, at least not in the default mode of operation. 2) The string expression compiler no longer unescapes values. Instead, this is left to each expression compiler. Currently only the Python expression compiler unescapes its input. 3) The dynamic escape code sequence now correctly only replaces ampersands that are part of an HTML escape format. Imports: - The page template classes and the loader class can now be imported directly from the ``chameleon`` module. Features: - If a custom template loader is not provided, relative paths are now resolved using ``os.abspath`` (i.e. to the current working directory). - Absolute paths are normalized using ``os.path.normpath`` and ``os.path.expanduser``. This ensures that all paths are kept in their "canonical" form. 2.0-rc4 (2011-03-03) -------------------- Bugfixes: - Fixed an issue where the output of an end-to-end string expression would raise an exception if the expression evaluated to ``None`` (it should simply output nothing). - The ``convert`` function (which is configurable on the template class level) now defaults to the ``translate`` function (at run-time). This fixes an issue where message objects were not translated (and thus converted to a string) using the a provided ``translate`` function. - Fixed string interpolation issue where an expression immediately succeeded by a right curly bracket would not parse. This fixes issue #5. - Fixed error where ``tal:condition`` would be evaluated after ``tal:repeat``. Features: - Python expression is now a TALES expression. That means that the pipe operator can be used to chain two or more expressions in a try-except sequence. This behavior was ported from the 1.x series. Note that while it's still possible to use the pipe character ("|") in an expression, it must now be escaped. - The template cache can now be shared by multiple processes. 2.0-rc3 (2011-03-02) -------------------- Bugfixes: - Fixed ``atexit`` handler. This fixes issue #3. - If a cache directory is specified, it will now be used even when not in debug mode. - Allow "comment" attribute in the TAL namespace. This fixes an issue in the sense that the reference engine allows any attribute within the TAL namespace. However, only "comment" is in common use. - The template constructor now accepts a flag ``debug`` which puts the template *instance* into debug-mode regardless of the global setting. This fixes issue #1. Features: - Added exception handler for exceptions raised while evaluating an expression. This handler raises (or attempts to) a new exception of the type ``RenderError``, with an additional base class of the original exception class. The string value of the exception is a formatted error message which includes the expression that caused the exception. If we are unable to create the exception class, the original exception is re-raised. 2.0-rc2 (2011-02-28) -------------------- - Fixed upload issue. 2.0-rc1 (2011-02-28) -------------------- - Initial public release. See documentation for what's new in this series. Chameleon-2.24/COPYRIGHT.txt0000644000175000001440000000032211531701455016075 0ustar mborchusers00000000000000Copyright (c) 2011 Malthe Borch and Contributors. All Rights Reserved. Portions (c) Zope Foundation and contributors (http://www.zope.org/). Portions (c) Edgewall Software. Portions (c) 2008 Armin Ronacher. Chameleon-2.24/LICENSE.txt0000644000175000001440000002046311531701545015617 0ustar mborchusers00000000000000The majority of the code in Chameleon is supplied under this license: A copyright notice accompanies this license document that identifies the copyright holders. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Portions of the code in Chameleon are supplied under the ZPL (headers within individiual files indicate that these portions are licensed under the ZPL): Zope Public License (ZPL) Version 2.1 ------------------------------------- A copyright notice accompanies this license document that identifies the copyright holders. This license has been certified as open source. It has also been designated as GPL compatible by the Free Software Foundation (FSF). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. The right to distribute this software or to use it for any purpose does not give you the right to use Servicemarks (sm) or Trademarks (tm) of the copyright holders. Use of them is covered by separate agreement with the copyright holders. 5. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Portions of the code in Chameleon are supplied under the BSD license (headers within individiual files indicate that these portions are licensed under this license): All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Portions of the code in Chameleon are supplied under the Python License (headers within individiual files indicate that these portions are licensed under this license): PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 -------------------------------------------- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python. 4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python, Licensee agrees to be bound by the terms and conditions of this License Agreement. Chameleon-2.24/MANIFEST.in0000644000175000001440000000013712210043501015510 0ustar mborchusers00000000000000recursive-include src/chameleon/tests/inputs * recursive-include src/chameleon/tests/outputs * Chameleon-2.24/Makefile0000644000175000001440000000607711672357540015451 0ustar mborchusers00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = docs SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Chameleon.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Chameleon.qhc" latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." Chameleon-2.24/README.rst0000644000175000001440000000125712245600576015470 0ustar mborchusers00000000000000Overview ======== Chameleon is an HTML/XML template engine for `Python `_. It uses the *page templates* language. You can use it in any Python web application with just about any version of Python (2.5 and up, including 3.x and `pypy `_). Visit the `website `_ for more information or the `documentation `_. License and Copyright --------------------- This software is made available as-is under a BSD-like license [1]_ (see included copyright notice). Notes ----- .. [1] This software is licensed under the `Repoze `_ license. Chameleon-2.24/setup.py0000644000175000000120000000437312614070247015446 0ustar mborchwheel00000000000000__version__ = '2.24' import os import sys from setuptools import setup, find_packages from setuptools.command.test import test here = os.path.abspath(os.path.dirname(__file__)) try: README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.rst')).read() except: # doesn't work under tox/pip README = '' CHANGES = '' install_requires = [] version = sys.version_info[:3] if version < (2, 7, 0): install_requires.append("ordereddict") install_requires.append("unittest2") class Benchmark(test): description = "Run benchmarks" user_options = [] test_suite = None def initialize_options(self): """init options""" pass def finalize_options(self): """finalize options""" self.distribution.tests_require = [ 'zope.pagetemplate', 'zope.component', 'zope.i18n', 'zope.testing'] def run(self): test.run(self) self.with_project_on_sys_path(self.run_benchmark) def run_benchmark(self): from chameleon import benchmark print("running benchmark...") benchmark.start() setup( name="Chameleon", version=__version__, description="Fast HTML/XML Template Compiler.", long_description="\n\n".join((README, CHANGES)), classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", ], author="Malthe Borch", author_email="mborch@gmail.com", url="http://www.pagetemplates.org/", license='BSD-like (http://repoze.org/license.html)', packages=find_packages('src'), package_dir = {'': 'src'}, include_package_data=True, install_requires=install_requires, zip_safe=False, test_suite="chameleon.tests", cmdclass={ 'benchmark': Benchmark, } ) Chameleon-2.24/tox.ini0000644000175000001440000000077312330132532015301 0ustar mborchusers00000000000000[tox] envlist = py26,py27,py32,py33,py34,pypy,cover [testenv] commands = python setup.py test -q [testenv:py26] commands = python setup.py test -q deps = ordereddict unittest2 [testenv:pypy] commands = python setup.py test -q deps = ordereddict unittest2 zope.interface [testenv:cover] basepython = python2.6 commands = python setup.py nosetests --with-xunit --with-xcoverage deps = nose coverage==3.4 nosexcover ordereddict unittest2 Chameleon-2.24/PKG-INFO0000644000175000000120000013756712614070273015044 0ustar mborchwheel00000000000000Metadata-Version: 1.1 Name: Chameleon Version: 2.24 Summary: Fast HTML/XML Template Compiler. Home-page: http://www.pagetemplates.org/ Author: Malthe Borch Author-email: mborch@gmail.com License: BSD-like (http://repoze.org/license.html) Description: Overview ======== Chameleon is an HTML/XML template engine for `Python `_. It uses the *page templates* language. You can use it in any Python web application with just about any version of Python (2.5 and up, including 3.x and `pypy `_). Visit the `website `_ for more information or the `documentation `_. License and Copyright --------------------- This software is made available as-is under a BSD-like license [1]_ (see included copyright notice). Notes ----- .. [1] This software is licensed under the `Repoze `_ license. Changes ======= 2.24 (2015-10-28) ----------------- - Fixed Python 3.5 compatibility. - Fixed brown bag release. 2.23 (2015-10-26) ----------------- - Added ``enable_data_attributes`` option that allows using HTML5 data attributes as control attributes instead or in addition to XML namespace attributes. 2.22 (2015-02-06) ----------------- - Fix brown bag release. 2.21 (2015-02-06) ----------------- - Added ``RenderError`` exception which indicates that an error occurred during the evaluation of an expression. - Clean up ``TemplateError`` exception implementation. 2.20 (2015-01-12) ----------------- - Pass ``search_path`` to template class when loaded using ``TemplateLoader`` (or one of the derived classes). [faassen] 2.19 (2015-01-06) ----------------- - Fix logging deprecation. - Fix environment-based configuration logging error. 2.18 (2014-11-03) ----------------- - Fix minor compilation error. 2.17 (2014-11-03) ----------------- - Add support for ``i18n:context``. [wiggy] - Add missing 'parity' repeat property. [voxspox] - Don't modify environment when getting variables from it. [fschulze] 2.16 (2014-05-06) ----------------- - If a repeat expression evaluates to ``None`` then it is now equivalent to an empty set. This changes a behavior introduced in 2.14. This fixes issue #172. - Remove fossil test dependency on deprecated ``distribute``. - Add explicit support / testing for Python 3.3 / 3.4. - Drop explicit support for Python 2.5 (out of maintenance, and no longer supported by ``tox`` or ``Travis-CI``). 2.15 (2014-03-11) ----------------- - Add Support for Python 3.4's ``NameConstant``. [brakhane] 2.14 (2013-11-28) ----------------- - Element repetition using the ``TAL`` namespace no longer includes whitespace. This fixes issue #110. - Use absolute import for ``chameleon.interfaces`` module. This fixes issue #161. 2.13-1 (2013-10-24) ------------------- - Fixing brown bag release. 2.13 (2013-10-21) ----------------- Bugfixes: - The template cache mechanism now includes additional configuration settings as part of the cache key such as ``strict`` and ``trim_attribute_space``. [ossmkitty] - Fix cache issue where sometimes cached templates would not load correctly. [ossmkitty] - In debug-mode, correctly remove temporary files when the module loader is garbage-collected (on ``__del__``). [graffic] - Fix error message when duplicate i18n:name directives are used in a translation. - Using the three-argument form of ``getattr`` on a ``chameleon.tal.RepeatDict`` no longer raises ``KeyError``, letting the default provided to ``getattr`` be used. This fixes attempting to adapt a ``RepeatDict`` to a Zope interface under PyPy. 2.12 (2013-03-26) ----------------- Changes: - When a ``tal:case`` condition succeeds, no other case now will. Bugfixes: - Implicit translation now correctly extracts and normalizes complete sentences, instead of words. [witsch] - The ``default`` symbol in a ``tal:case`` condition now allows the element only if no other case succeeds. 2.11 (2012-11-15) ----------------- Bugfixes: - An issue was resolved where a METAL statement was combined with a ``tal:on-error`` handler. - Fix minor parser issue with incorrectly formatted processing instructions. - Provide proper error handling for Python inline code blocks. Features: - The simple translation function now supports the ``translationstring`` interface. Optimizations: - Minor optimization which correctly detects when an element has no attributes. 2.10 (2012-10-12) ----------------- Deprecations: - The ``fast_translate`` function has been deprecated. Instead, the default translation function is now always a function that simply interpolates the mapping onto the message default or id. The motivation is that since version 2.9, the ``context`` argument is non-trivial: the ``econtext`` mapping is passed. This breaks an expectation on the Zope platform that the ``context`` parameter is the HTTP request. Previously, with Chameleon this parameter was simply not provided and so that did not cause issues as such. - The ``ast24`` module has been renamed to ``ast25``. This should help clear up any confusion that Chameleon 2.x might be support a Python interpreter less than version 2.5 (it does not). Features: - The ``ProxyExpr`` expression class (and hence the ``load:`` expression type) is now a TALES-expression. In practical terms, this means that the expression type (which computes a string result using the standard ``"${...}"`` interpolation syntax and proxies the result through a function) now supports fallback using the pipe operator (``"|"``). This fixes issue #128. - An attempt to interpolate using the empty string as the expression (i.e. ``${}``) now does nothing: the string ``${}`` is simply output as is. - Added support for adding, modifying, and removing attributes using a dictionary expression in ``tal:attributes`` (analogous to Genshi's ``py:attrs`` directive)::
In the example above, ``name`` is an identifier, while ``value`` and ``attrs`` are Python expressions. However, ``attrs`` must evaluate to a Python dictionary object (more concisely, the value must implement the dictionary API-methods ``update()`` and ``items()``). Optimizations: - In order to cut down on the size of the compiled function objects, some conversion and quoting statements have been put into functions. In one measurement, the reduction was 35%. The benchmark suite does *not* report of an increased render time (actually slightly decreased). Bugfixes: - An exception is now raised if a trivial string is passed for ``metal:fill-slot``. This fixes issue #89. - An empty string is now never translated. Not really a bug, but it's been reported in as an issue (#92) because some translation frameworks handle this case incorrectly. - The template module loader (file cache) now correctly encodes generated template source code as UTF-8. This fixes issue #125. - Fixed issue where a closure might be reused unsafely in nested template rendering. - Fixed markup class ``__repr__`` method. This fixes issue #124. - Added missing return statement to fix printing the non-abbreviated filename in case of an exception. [tomo] 2.9.2 (2012-06-06) ------------------ Bugfixes: - Fixed a PyPy incompatibility. - Fixed issue #109 which caused testing failures on some platforms. 2.9.1 (2012-06-01) ------------------ Bugfixes: - Fixed issue #103. The ``tal:on-error`` statement now always adds an explicit end-tag to the element, even with a substitution content of nothing. - Fixed issue #113. The ``tal:on-error`` statement now works correctly also for dynamic attributes. That is, the fallback tag now includes only static attributes. - Fixed name error which prevented the benchmark from running correctly. Compatibility: - Fixed deprecation warning on Python 3 for zope interface implements declaration. This fixes issue #116. 2.9.0 (2012-05-31) ------------------ Features: - The translation function now gets the ``econtext`` argument as the value for ``context``. Note that historically, this was usually an HTTP request which might provide language negotiation data through a dictionary interface. [alvinyue] Bugfixes: - Fixed import alias issue which would lead to a syntax error in generated Python code. Fixes issue #114. 2.8.5 (2012-05-02) ------------------ Bugfixes: - Fixed minor installation issues on Python 2.5 and 3. [ppaez] - Ensure output is unicode even when trivial (an empty string). 2.8.4 (2012-04-18) ------------------ Features: - In exception output, long filenames are now truncated to 60 characters of output, preventing line wrap which makes it difficult to scan the exception output. Bugfixes: - Include filename and location in exception output for exceptions raised during compilation. - If a trivial translation substitution variable is given (i.e. an empty string), simply ignore it. This fixes issue #106. 2.8.3 (2012-04-16) ------------------ Features: - Log template source on debug-level before cooking. - The `target_language` argument, if given, is now available as a variable in templates. 2.8.2 (2012-03-30) ------------------ Features: - Temporary caches used in debug mode are cleaned up eagerly, rather than waiting for process termination. [mitchellrj] Bugfixes: - The `index`, `start` and `end` methods on the TAL repeat object are now callable. This fixes an incompatibility with ZPT. - The loader now correctly handles absolute paths on Windows. [rdale] 2.8.1 (2012-03-29) ------------------ Features: - The exception formatter now lists errors in 'wrapping order'. This means that the innermost, and presumably most relevant exception is shown last. Bugfixes: - The exception formatter now correctly recognizes nested errors and does not rewrap the dynamically generated exception class. - The exception formatter now correctly sets the ``__module__`` attribute to that of the original exception class. 2.8.0 (2012-02-29) ------------------ Features: - Added support for code blocks using the `` processing instruction syntax. The scope is name assignments is up until the nearest macro definition, or the template itself if macros are not used. Bugfixes: - Fall back to the exception class' ``__new__`` method to safely create an exception object that is not implemented in Python. - The exception formatter now keeps track of already formatted exceptions, and ignores them from further output. 2.7.4 (2012-02-27) ------------------ - The error handler now invokes the ``__init__`` method of ``BaseException`` instead of the possibly overriden method (which may take required arguments). This fixes issue #97. [j23d, malthe] 2.7.3 (2012-01-16) ------------------ Bugfixes: - The trim whitespace option now correctly trims actual whitespace to a single character, appearing either to the left or to the right of an element prefix or suffix string. 2.7.2 (2012-01-08) ------------------ Features: - Added option ``trim_attribute_space`` that decides whether attribute whitespace is stripped (at most down to a single space). This option exists to provide compatibility with the reference implementation. Fixes issue #85. Bugfixes: - Ignore unhashable builtins when generating a reverse builtin map to quickly look up a builtin value. [malthe] - Apply translation mapping even when a translation function is not available. This fixes issue #83. [malthe] - Fixed issue #80. The translation domain for a slot is defined by the source document, i.e. the template providing the content for a slot whether it be the default or provided through ``metal:fill-slot``. [jcbrand] - In certain circumstances, a Unicode non-breaking space character would cause a define clause to fail to parse. 2.7.1 (2011-12-29) ------------------ Features: - Enable expression interpolation in CDATA. - The page template class now implements dictionary access to macros:: template[name] This is a short-hand for:: template.macros[name] Bugfixes: - An invalid define clause would be silently ignored; we now raise a language error exception. This fixes issue #79. - Fixed regression where ``${...}`` interpolation expressions could not span multiple lines. This fixes issue #77. 2.7.0 (2011-12-13) ------------------ Features: - The ``load:`` expression now derives from the string expression such that the ``${...}`` operator can be used for expression interpolation. - The ``load:`` expression now accepts asset specs; these are resolved by the ``pkg_resources.resource_filename`` function:: : An example from the test suite:: chameleon:tests/inputs/hello_world.pt Bugfixes: - If an attribute name for translation was not a valid Python identifier, the compiler would generate invalid code. This has been fixed, and the compiler now also throws an exception if an attribute specification contains a comma. (Note that the only valid separator character is the semicolon, when specifying attributes for translation via the ``i18n:translate`` statement). This addresses issue #76. 2.6.2 (2011-12-08) ------------------ Bugfixes: - Fixed issue where ``tal:on-error`` would not respect ``tal:omit-tag`` or namespace elements which are omitted by default (such as ````). - Fixed issue where ``macros`` attribute would not be available on file-based templates due to incorrect initialization. - The ``TryExcept`` and ``TryFinally`` AST nodes are not available on Python 3.3. These have been aliased to ``Try``. This fixes issue #75. Features: - The TAL repeat item now makes a security declaration that grants access to unprotected subobjects on the Zope 2 platform:: __allow_access_to_unprotected_subobjects__ = True This is required for legacy compatibility and does not affect other environments. - The template object now has a method ``write(body)`` which explicitly decodes and cooks a string input. - Added configuration option ``loader_class`` which sets the class used to create the template loader object. The class (essentially a callable) is created at template construction time. 2.6.1 (2011-11-30) ------------------ Bugfixes: - Decode HTML entities in expression interpolation strings. This fixes issue #74. - Allow ``xml`` and ``xmlns`` attributes on TAL, I18N and METAL namespace elements. This fixes issue #73. 2.6.0 (2011-11-24) ------------------ Features: - Added support for implicit translation: The ``implicit_i18n_translate`` option enables implicit translation of text. The ``implicit_i18n_attributes`` enables implicit translation of attributes. The latter must be a set and for an attribute to be implicitly translated, its lowercase string value must be included in the set. - Added option ``strict`` (enabled by default) which decides whether expressions are required to be valid at compile time. That is, if not set, an exception is only raised for an invalid expression at evaluation time. - An expression error now results in an exception only if the expression is attempted evaluated during a rendering. - Added a configuration option ``prepend_relative_search_path`` which decides whether the path relative to a file-based template is prepended to the load search path. The default is ``True``. - Added a configuration option ``search_path`` to the file-based template class, which adds additional paths to the template load instance bound to the ``load:`` expression. The option takes a string path or an iterable yielding string paths. The default value is the empty set. Bugfixes: - Exception instances now support pickle/unpickle. - An attributes in i18n:attributes no longer needs to match an existing or dynamic attribute in order to appear in the element. This fixes issue #66. 2.5.3 (2011-10-23) ------------------ Bugfixes: - Fixed an issue where a nested macro slot definition would fail even though there existed a parent macro definition. This fixes issue #69. 2.5.2 (2011-10-12) ------------------ Bugfixes: - Fixed an issue where technically invalid input would result in a compiler error. Features: - The markup class now inherits from the unicode string type such that it's compatible with the string interface. 2.5.1 (2011-09-29) ------------------ Bugfixes: - The symbol names "convert", "decode" and "translate" are now no longer set as read-only *compiler internals*. This fixes issue #65. - Fixed an issue where a macro extension chain nested two levels (a template uses a macro that extends a macro) would lose the middle slot definitions if slots were defined nested. The compiler now throws an error if a nested slot definition is used outside a macro extension context. 2.5.0 (2011-09-23) ------------------ Features: - An expression type ``structure:`` is now available which wraps the expression result as *structure* such that it is not escaped on insertion, e.g.::
${structure: context.body}
This also means that the ``structure`` keyword for ``tal:content`` and ``tal:replace`` now has an alternative spelling via the expression type ``structure:``. - The string-based template constructor now accepts encoded input. 2.4.6 (2011-09-23) ------------------ Bugfixes: - The ``tal:on-error`` statement should catch all exceptions. - Fixed issue that would prevent escaping of interpolation expression values appearing in text. 2.4.5 (2011-09-21) ------------------ Bugfixes: - The ``tal:on-error`` handler should have a ``error`` variable defined that has the value of the exception thrown. - The ``tal:on-error`` statement is a substitution statement and should support the "text" and "structure" insertion methods. 2.4.4 (2011-09-15) ------------------ Bugfixes: - An encoding specified in the XML document preamble is now read and used to decode the template input to unicode. This fixes issue #55. - Encoded expression input on Python 3 is now correctly decoded. Previously, the string representation output would be included instead of an actually decoded string. - Expression result conversion steps are now correctly included in error handling such that the exception output points to the expression location. 2.4.3 (2011-09-13) ------------------ Features: - When an encoding is provided, pass the 'ignore' flag to avoid decoding issues with bad input. Bugfixes: - Fixed pypy compatibility issue (introduced in previous release). 2.4.2 (2011-09-13) ------------------ Bugfixes: - Fixed an issue in the compiler where an internal variable (such as a translation default value) would be cached, resulting in variable scope corruption (see issue #49). 2.4.1 (2011-09-08) ------------------ Bugfixes: - Fixed an issue where a default value for an attribute would sometimes spill over into another attribute. - Fixed issue where the use of the ``default`` name in an attribute interpolation expression would print the attribute value. This is unexpected, because it's an expression, not a static text suitable for output. An attribute value of ``default`` now correctly drops the attribute. 2.4.0 (2011-08-22) ------------------ Features: - Added an option ``boolean_attributes`` to evaluate and render a provided set of attributes using a boolean logic: if the attribute is a true value, the value will be the attribute name, otherwise the attribute is dropped. In the reference implementation, the following attributes are configured as boolean values when the template is rendered in HTML-mode:: "compact", "nowrap", "ismap", "declare", "noshade", "checked", "disabled", "readonly", "multiple", "selected", "noresize", "defer" Note that in Chameleon, these attributes must be manually provided. Bugfixes: - The carriage return character (used on Windows platforms) would incorrectly be included in Python comments. It is now replaced with a line break. This fixes issue #44. 2.3.8 (2011-08-19) ------------------ - Fixed import error that affected Python 2.5 only. 2.3.7 (2011-08-19) ------------------ Features: - Added an option ``literal_false`` that disables the default behavior of dropping an attribute for a value of ``False`` (in addition to ``None``). This modified behavior is the behavior exhibited in reference implementation. Bugfixes: - Undo attribute special HTML attribute behavior (see previous release). This turned out not to be a compatible behavior; rather, boolean values should simply be coerced to a string. Meanwhile, the reference implementation does support an HTML mode in which the special attribute behavior is exhibited. We do not currently support this mode. 2.3.6 (2011-08-18) ------------------ Features: - Certain HTML attribute names now have a special behavior for a attribute value of ``True`` (or ``default`` if no default is defined). For these attributes, this return value will result in the name being printed as the value:: will be rendered as:: This behavior is compatible with the reference implementation. 2.3.5 (2011-08-18) ------------------ Features: - Added support for the set operator (``{item, item, ...}``). Bugfixes: - If macro is defined on the same element as a translation name, this no longer results in a "translation name not allowed outside translation" error. This fixes issue #43. - Attribute fallback to dictionary lookup now works on multiple items (e.g. ``d1.d2.d2``). This fixes issue #42. 2.3.4 (2011-08-16) ------------------ Features: - When inserting content in either attributes or text, a value of ``True`` (like ``False`` and ``None``) will result in no action. - Use statically assigned variables for ``"attrs"`` and ``"default"``. This change yields a performance improvement of 15-20%. - The template loader class now accepts an optional argument ``default_extension`` which accepts a filename extension which will be appended to the filename if there's not already an extension. Bugfixes: - The default symbol is now ``True`` for an attribute if the attribute default is not provided. Note that the result is that the attribute is dropped. This fixes issue #41. - Fixed an issue where assignment to a variable ``"type"`` would fail. This fixes issue #40. - Fixed an issue where an (unsuccesful) assignment for a repeat loop to a compiler internal name would not result in an error. - If the translation function returns the identical object, manually coerce it to string. This fixes a compatibility issue with translation functions which do not convert non-string objects to a string value, but simply return them unchanged. 2.3.3 (2011-08-15) ------------------ Features: - The ``load:`` expression now passes the initial keyword arguments to its template loader (e.g. ``auto_reload`` and ``encoding``). - In the exception output, string variable values are now limited to a limited output of characters, single line only. Bugfixes: - Fixed horizontal alignment of exception location info (i.e. 'String:', 'Filename:' and 'Location:') such that they match the template exception formatter. 2.3.2 (2011-08-11) ------------------ Bugfixes: - Fixed issue where i18n:domain would not be inherited through macros and slots. This fixes issue #37. 2.3.1 (2011-08-11) ------------------ Features: - The ``Builtin`` node type may now be used to represent any Python local or global name. This allows expression compilers to refer to e.g. ``get`` or ``getitem``, or to explicit require a builtin object such as one from the ``extra_builtins`` dictionary. Bugfixes: - Builtins which are not explicitly disallowed may now be redefined and used as variables (e.g. ``nothing``). - Fixed compiler issue with circular node annotation loop. 2.3 (2011-08-10) ---------------- Features: - Added support for the following syntax to disable inline evaluation in a comment: Note that the initial question mark character (?) will be omitted from output. - The parser now accepts '<' and '>' in attributes. Note that this is invalid markup. Previously, the '<' would not be accepted as a valid attribute value, but this would result in an 'unexpected end tag' error elsewhere. This fixes issue #38. - The expression compiler now provides methods ``assign_text`` and ``assign_value`` such that a template engine might configure this value conversion to support e.g. encoded strings. Note that currently, the only client for the ``assign_text`` method is the string expression type. - Enable template loader for string-based template classes. Note that the ``filename`` keyword argument may be provided on initialization to identify the template source by filename. This fixes issue #36. - Added ``extra_builtins`` option to the page template class. These builtins are added to the default builtins dictionary at cook time and may be provided at initialization using the ``extra_builtins`` keyword argument. Bugfixes: - If a translation domain is set for a fill slot, use this setting instead of the macro template domain. - The Python expression compiler now correctly decodes HTML entities ``'gt'`` and ``'lt'``. This fixes issue #32. - The string expression compiler now correctly handles encoded text (when support for encoded strings is enabled). This fixes issue #35. - Fixed an issue where setting the ``filename`` attribute on a file-based template would not automatically cause an invalidation. - Exceptions raised by Chameleon can now be copied via ``copy.copy``. This fixes issue #36. [leorochael] - If copying the exception fails in the exception handler, simply re-raise the original exception and log a warning. 2.2 (2011-07-28) ---------------- Features: - Added new expression type ``load:`` that allows loading a template. Both relative and absolute paths are supported. If the path given is relative, then it will be resolved with respect to the directory of the template. - Added support for dynamic evaluation of expressions. Note that this is to support legacy applications. It is not currently wired into the provided template classes. - Template classes now have a ``builtins`` attribute which may be used to define built-in variables always available in the template variable scope. Incompatibilities: - The file-based template class no longer accepts a parameter ``loader``. This parameter would be used to load a template from a relative path, using a ``find(filename)`` method. This was however, undocumented, and probably not very useful since we have the ``TemplateLoader`` mechanism already. - The compiled template module now contains an ``initialize`` function which takes values that map to the template builtins. The return value of this function is a dictionary that contains the render functions. Bugfixes: - The file-based template class no longer verifies the existance of a template file (using ``os.lstat``). This now happens implicitly if eager parsing is enabled, or otherwise when first needed (e.g. at render time). This is classified as a bug fix because the previous behavior was probably not what you'd expect, especially if an application initializes a lot of templates without needing to render them immediately. 2.1.1 (2011-07-28) ------------------ Features: - Improved exception display. The expression string is now shown in the context of the original source (if available) with a marker string indicating the location of the expression in the template source. Bugfixes: - The ``structure`` insertion mode now correctly decodes entities for any expression type (including ``string:``). This fixes issue #30. - Don't show internal variables in the exception formatter variable listing. 2.1 (2011-07-25) ---------------- Features: - Expression interpolation (using the ``${...}`` operator and previously also ``$identifier``) now requires braces everywhere except inside the ``string:`` expression type. This change is motivated by a number of legacy templates in which the interpolation format without braces ``$identifier`` appears as text. 2.0.2 (2011-07-25) ------------------ Bugfixes: - Don't use dynamic variable scope for lambda-scoped variables (#27). - Avoid duplication of exception class and message in traceback. - Fixed issue where a ``metal:fill-slot`` would be ignored if a macro was set to be used on the same element (#16). 2.0.1 (2011-07-23) ------------------ Bugfixes: - Fixed issue where global variable definition from macro slots would fail (they would instead be local). This also affects error reporting from inside slots because this would be recorded internally as a global. - Fixed issue with template cache digest (used for filenames); modules are now invalidated whenever any changes are made to the distribution set available (packages on ``sys.path``). - Fixed exception handler to better let exceptions propagate through the renderer. - The disk-based module compiler now mangles template source filenames such that the output Python module is valid and at root level (dots and hyphens are replaced by an underscore). This fixes issue #17. - Fixed translations (i18n) on Python 2.5. 2.0 (2011-07-14) ---------------- - Point release. 2.0-rc14 (2011-07-13) --------------------- Bugfixes: - The tab character (``\t``) is now parsed correctly when used inside tags. Features: - The ``RepeatDict`` class now works as a proxy behind a seperate dictionary instance. - Added template constructor option ``keep_body`` which is a flag (also available as a class attribute) that controls whether to save the template body input in the ``body`` attribute. This is disabled by default, unless debug-mode is enabled. - The page template loader class now accepts an optional ``formats`` argument which can be used to select an alternative template class. 2.0-rc13 (2011-07-07) --------------------- Bugfixes: - The backslash character (followed by optional whitespace and a line break) was not correctly interpreted as a continuation for Python expressions. Features: - The Python expression implementation is now more flexible for external subclassing via a new ``parse`` method. 2.0-rc12 (2011-07-04) --------------------- Bugfixes: - Initial keyword arguments passed to a template now no longer "leak" into the template variable space after a macro call. - An unexpected end tag is now an unrecoverable error. Features: - Improve exception output. 2.0-rc11 (2011-05-26) --------------------- Bugfixes: - Fixed issue where variable names that begin with an underscore were seemingly allowed, but their use resulted in a compiler error. Features: - Template variable names are now allowed to be prefixed with a single underscore, but not two or more (reserved for internal use). Examples of valid names:: item ITEM _item camelCase underscore_delimited help - Added support for Genshi's comment "drop" syntax:: Note the additional exclamation (!) character. This fixes addresses issue #10. 2.0-rc10 (2011-05-24) --------------------- Bugfixes: - The ``tal:attributes`` statement now correctly operates case-insensitive. The attribute name given in the statement will replace an existing attribute with the same name, without respect to case. Features: - Added ``meta:interpolation`` statement to control expression interpolation setting. Strings that disable the setting: ``"off"`` and ``"false"``. Strings that enable the setting: ``"on"`` and ``"true"``. - Expression interpolation now works inside XML comments. 2.0-rc9 (2011-05-05) -------------------- Features: - Better debugging support for string decode and conversion. If a naive join fails, each element in the output will now be attempted coerced to unicode to try and trigger the failure near to the bad string. 2.0-rc8 (2011-04-11) -------------------- Bugfixes: - If a macro defines two slots with the same name, a caller will now fill both with a single usage. - If a valid of ``None`` is provided as the translation function argument, we now fall back to the class default. 2.0-rc7 (2011-03-29) -------------------- Bugfixes: - Fixed issue with Python 2.5 compatibility AST. This affected at least PyPy 1.4. Features: - The ``auto_reload`` setting now defaults to the class value; the base template class gives a default value of ``chameleon.config.AUTO_RELOAD``. This change allows a subclass to provide a custom default value (such as an application-specific debug mode setting). 2.0-rc6 (2011-03-19) -------------------- Features: - Added support for ``target_language`` keyword argument to render method. If provided, the argument will be curried onto the translation function. Bugfixes: - The HTML entities 'lt', 'gt' and 'quot' appearing inside content subtition expressions are now translated into their native character values. This fixes an issue where you could not dynamically create elements using the ``structure`` (which is possible in ZPT). The need to create such structure stems from the lack of an expression interpolation operator in ZPT. - Fixed duplicate file pointer issue with test suite (affected Windows platforms only). This fixes issue #9. [oliora] - Use already open file using ``os.fdopen`` when trying to write out the module source. This fixes LP #731803. 2.0-rc5 (2011-03-07) -------------------- Bugfixes: - Fixed a number of issues concerning the escaping of attribute values: 1) Static attribute values are now included as they appear in the source. This means that invalid attribute values such as ``"true && false"`` are now left alone. It's not the job of the template engine to correct such markup, at least not in the default mode of operation. 2) The string expression compiler no longer unescapes values. Instead, this is left to each expression compiler. Currently only the Python expression compiler unescapes its input. 3) The dynamic escape code sequence now correctly only replaces ampersands that are part of an HTML escape format. Imports: - The page template classes and the loader class can now be imported directly from the ``chameleon`` module. Features: - If a custom template loader is not provided, relative paths are now resolved using ``os.abspath`` (i.e. to the current working directory). - Absolute paths are normalized using ``os.path.normpath`` and ``os.path.expanduser``. This ensures that all paths are kept in their "canonical" form. 2.0-rc4 (2011-03-03) -------------------- Bugfixes: - Fixed an issue where the output of an end-to-end string expression would raise an exception if the expression evaluated to ``None`` (it should simply output nothing). - The ``convert`` function (which is configurable on the template class level) now defaults to the ``translate`` function (at run-time). This fixes an issue where message objects were not translated (and thus converted to a string) using the a provided ``translate`` function. - Fixed string interpolation issue where an expression immediately succeeded by a right curly bracket would not parse. This fixes issue #5. - Fixed error where ``tal:condition`` would be evaluated after ``tal:repeat``. Features: - Python expression is now a TALES expression. That means that the pipe operator can be used to chain two or more expressions in a try-except sequence. This behavior was ported from the 1.x series. Note that while it's still possible to use the pipe character ("|") in an expression, it must now be escaped. - The template cache can now be shared by multiple processes. 2.0-rc3 (2011-03-02) -------------------- Bugfixes: - Fixed ``atexit`` handler. This fixes issue #3. - If a cache directory is specified, it will now be used even when not in debug mode. - Allow "comment" attribute in the TAL namespace. This fixes an issue in the sense that the reference engine allows any attribute within the TAL namespace. However, only "comment" is in common use. - The template constructor now accepts a flag ``debug`` which puts the template *instance* into debug-mode regardless of the global setting. This fixes issue #1. Features: - Added exception handler for exceptions raised while evaluating an expression. This handler raises (or attempts to) a new exception of the type ``RenderError``, with an additional base class of the original exception class. The string value of the exception is a formatted error message which includes the expression that caused the exception. If we are unable to create the exception class, the original exception is re-raised. 2.0-rc2 (2011-02-28) -------------------- - Fixed upload issue. 2.0-rc1 (2011-02-28) -------------------- - Initial public release. See documentation for what's new in this series. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.1 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Chameleon-2.24/setup.cfg0000644000175000000120000000042412614070273015545 0ustar mborchwheel00000000000000[easy_install] zip_ok = false [nosetests] match = ^test nocapture = 1 cover-package = tree.codegen, tree.lexer, tree.parser, tree.nodes, tree.translation, tree.language, tree.tales, tree.expressions cover-erase = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0