There are no keys.
``path`` expressions -------------------- Syntax ~~~~~~ Path expression syntax:: PathExpr ::= Path [ '|' Expression ] Path ::= variable [ '/' PathSegment ]* variable ::= Name PathSegment ::= ( '?' variable ) | PathChar+ PathChar ::= AlphaNumeric | ' ' | '_' | '-' | '.' | ',' | '~' Description ~~~~~~~~~~~ A path expression consists of a *path* optionally followed by a vertical bar (|) and alternate expression. A path consists of one or more non-empty strings separated by slashes. The first string must be a variable name (a built-in variable or a user defined variable), and the remaining strings, the *path segments*, may contain letters, digits, spaces, and the punctuation characters underscore, dash, period, comma, and tilde. A limited amount of indirection is possible by using a variable name prefixed with ``?`` as a path segment. The variable must contain a string, which replaces that segment before the path is traversed. For example:: request/cookies/oatmeal nothing here/some-file 2001_02.html.tar.gz/foo root/to/branch | default request/name | string:Anonymous Coward here/?tname/macros/?mname When a path expression is evaluated, :mod:`z3c.pt` attempts to traverse the path, from left to right, until it succeeds or runs out of paths segments. To traverse a path, it first fetches the object stored in the variable. For each path segment, it traverses from the current object to the subobject named by the path segment. Subobjects are located according to standard traversal rules. .. note:: The Zope 3 traversal API is used to traverse to subobjects. The `five.ptUser name
``python`` expressions ---------------------- Syntax ~~~~~~ Python expression syntax:: Any valid Python language expression Description ~~~~~~~~~~~ Python expressions evaluate Python code in a restricted environment (no access to variables starting with an underscore). Python expressions offer the same facilities as those available in Python-based Scripts and DTML variable expressions. .. warning: Zope 2 page templates may be executed in a security-restricted environment which ties in with the Zope 2 security model. This is not supported by :mod:`z3c.pt`. Examples ~~~~~~~~ Using a module usage (pick a random choice from a list):: A random number between one and five String processing (capitalize the user name)::User Name
Basic math (convert an image size to megabytes)::12.2323
String formatting (format a float to two decimal places)::13.56
``string`` expressions ---------------------- Syntax ~~~~~~ String expression syntax:: string_expression ::= ( plain_string | [ varsub ] )* varsub ::= ( '$' Path ) | ( '${' Path '}' ) 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 ``${path}``, where ``name`` is a variable name, and ``path`` is a path expression. The escaped string value of the path expression is inserted into the string. .. note:: To prevent a ``$`` from being interpreted this way, it must be escaped as ``$$``. Examples ~~~~~~~~ Basic string formatting:: Spam and Eggs Using paths::total: 12
Including a dollar sign::cost: $42.00
z3c.pt-2.2.3/src/ 0000755 0001750 0000144 00000000000 11762105444 014063 5 ustar mborch users 0000000 0000000 z3c.pt-2.2.3/src/z3c.pt.egg-info/ 0000755 0001750 0000144 00000000000 11762105444 016676 5 ustar mborch users 0000000 0000000 z3c.pt-2.2.3/src/z3c.pt.egg-info/SOURCES.txt 0000644 0001750 0000144 00000002036 11762105440 020557 0 ustar mborch users 0000000 0000000 AUTHOR.txt CHANGES.txt CONTRIBUTORS.txt COPYRIGHT.txt LICENSE.txt README.txt bootstrap.py buildout.cfg setup.py docs/Makefile docs/api.rst docs/conf.py docs/index.rst docs/narr/i18n.rst docs/narr/tales.rst src/z3c/__init__.py src/z3c.pt.egg-info/PKG-INFO src/z3c.pt.egg-info/SOURCES.txt src/z3c.pt.egg-info/dependency_links.txt src/z3c.pt.egg-info/namespace_packages.txt src/z3c.pt.egg-info/not-zip-safe src/z3c.pt.egg-info/requires.txt src/z3c.pt.egg-info/top_level.txt src/z3c/pt/README.txt src/z3c/pt/__init__.py src/z3c/pt/configure.zcml src/z3c/pt/expressions.py src/z3c/pt/loader.py src/z3c/pt/namespaces.py src/z3c/pt/pagetemplate.py src/z3c/pt/tests/__init__.py src/z3c/pt/tests/boolean.pt src/z3c/pt/tests/exists.pt src/z3c/pt/tests/false.pt src/z3c/pt/tests/function_namespaces.pt src/z3c/pt/tests/helloworld.pt src/z3c/pt/tests/nocall.pt src/z3c/pt/tests/path.pt src/z3c/pt/tests/provider.pt src/z3c/pt/tests/test_doctests.py src/z3c/pt/tests/test_loader.py src/z3c/pt/tests/test_templates.py src/z3c/pt/tests/view.css src/z3c/pt/tests/view.pt z3c.pt-2.2.3/src/z3c.pt.egg-info/not-zip-safe 0000644 0001750 0000144 00000000001 11436766546 021142 0 ustar mborch users 0000000 0000000 z3c.pt-2.2.3/src/z3c.pt.egg-info/PKG-INFO 0000644 0001750 0000144 00000106037 11762105440 017776 0 ustar mborch users 0000000 0000000 Metadata-Version: 1.1 Name: z3c.pt Version: 2.2.3 Summary: Fast ZPT engine. Home-page: UNKNOWN Author: Malthe Borch and the Zope Community Author-email: zope-dev@zope.org License: ZPL Description: Overview ======== This is a fast implementation of the ZPT template engine for Zope 3 which uses Chameleon to compile templates to byte-code. The package provides application support equivalent to ``zope.app.pagetemplate``. For usage, see the README.txt file inside the package. Changelog ========= 2.2.3 (2012-06-01) ~~~~~~~~~~~~~~~~~~ Compatibility: - The translation function now accepts (but ignores) a ``context`` argument. This fixes a compatibility issue with Chameleon 2.9.x. 2.2.2 (2012-04-24) ~~~~~~~~~~~~~~~~~~ Bugfixes: - Do not rely on the "LANGUAGE" request key to skip language negotiation. Instead, we assume that negotiation is cheap (and probably cached). 2.2.1 (2012-02-15) ~~~~~~~~~~~~~~~~~~ - Only require Chameleon >= 2.4, was needlessly bumped in last release. - Add test extra, remove versions from buildout.cfg. 2.2 (2012-01-08) ~~~~~~~~~~~~~~~~ Features: - Whitespace between attributes is now reduced to a single whitespace character. - The ``request`` symbol is no longer required to evaluate a path expression; it now defaults to ``None`` if not present in the namespace. Bugfixes: - The content provider expression now correctly applies TAL namespace data. Changes: - The ``ZopeTraverser`` class has been removed and replaced with a simple function. 2.1.5 (2011-11-24) ~~~~~~~~~~~~~~~~~~ - Use non-strict mode if available for compatibility with the reference engine where expressions are only compiled at evaluation time. 2.1.4 (2011-09-14) ~~~~~~~~~~~~~~~~~~ - The provider expression is now first evaluated as a string expression, the result of which is used as the content provider name. This fixes an issue where (provider-) string expressions would not get evaluated correctly, e.g. ``provider: ${mgr}``. 2.1.3 (2011-08-22) ~~~~~~~~~~~~~~~~~~ - Configure HTML boolean attributes (in HTML-mode only):: "compact", "nowrap", "ismap", "declare", "noshade", "checked", "disabled", "readonly", "multiple", "selected", "noresize", "defer" 2.1.2 (2011-08-19) ~~~~~~~~~~~~~~~~~~ - Enable option ``literal_false`` to get the behavior that a value of ``False`` does not drop an attribute. 2.1.1 (2011-08-11) ~~~~~~~~~~~~~~~~~~ - Make sure the builtin names 'path' and 'exists' can be redefined. - Guard ``sys.modules`` (mapped to the builtin variable "modules") against import-time side effects using ``ProxyFactory``. 2.1 (2011-07-28) ~~~~~~~~~~~~~~~~ - Use dynamic expression evaluation framework that comes included with Chameleon. 2.0 (2011-07-14) ~~~~~~~~~~~~~~~~ - Point release. - Move implementation-specific context setup to ``render`` method. This allows use of template class with an already prepared context. - Fixed issue with the call flag on the Zope traverser compiler. 2.0-rc3 (2011-07-11) ~~~~~~~~~~~~~~~~~~~~ - Python-expressions are no longer TALES-expressions; previously, the pipe operator would split Python expression clauses, allowing fallbacks even for Python expressions, but this is not the standard behavior of ZPT. - Fixed an issue where an error which occurred inside a dynamic ``path`` or ``exists`` evaluation would fail to propagate due to a missing remote context. - Set variables ``here`` and ``context`` to the bound instance value on ``PageTemplate`` instances. 2.0-rc2 (2011-03-24) ~~~~~~~~~~~~~~~~~~~~ - Fixed an issue with ``"exists:"`` expression where a callable would be attempted called. It is meanwhile implied with this expression types that it should use the ``"nocall:"`` pragma. 2.0-rc1 (2011-02-28) ~~~~~~~~~~~~~~~~~~~~ - Update to Chameleon 2.0. This release includes many changes and is a complete rewrite of the 1.x series. Platform: * Python 2.5+ now required. Notable changes: * Expression interpolation is always enabled. * Whitespace output is different, now closely aligned to the template input. * New language constructs: 1) tal:on-error 2) tal:switch 3) tal:case Incompatibilities: * The expression translation interface has been replaced with an expression engine. This means that all expressions must be rewritten. - The exists expression evaluator should ignore KeyError exceptions as well. - Special-case handling of Zope2's Missing.MV as used by Products.ZCatalog for LP#649343. [rossp] 1.2.1 (2010/05/13) ------------------ - Bind template to the template object in the general case. 1.2 (2010/05/12) ------------------ - Fixed compatibility issue with recent change in Chameleon. - Fixed regression introduced with ``args`` being passed in. Incidentally, the name ``args`` was used as the star argument name. - Look at language set on request before invoking the zope.i18n negotiator. This makes i18n work again on Zope2. 1.1.1 (2010/04/06) ------------------ - Fixed issue where arguments were not passed on to template as ``args``. 1.1.0 (2010/01/09) ------------------ - Update to combined Chameleon distribution. 1.0.1 (2009/07/06) ------------------ - Bind translation context (request) to translation method. Although not required in newer versions of the translation machinery, some versions will ask for a translation context in order to negotiate language even when a language is explicitly passed in. - Declare zope security settings for classes when zope.security is present as the "class" ZCML directive was moved there. 1.0.0 (2009/07/06) ------------------ - First point release. 1.0b17 (2009/06/14) ------------------- - Made the Zope security declaration for the repeat dictionary be conditional on the presence of zope.app.security instead of zope.app.component. 1.0b16 (2009/05/20) ------------------- - Updated run-time expression evaluator method to work after a recent architectural change in Chameleon. [malthe] - Check that we have a non-trivial response-object before trying to set the content type. [malthe] - Wrap ``sys.modules`` dictionary in an "opaque" dictionary class, such that the representation string does not list all loaded modules. [malthe] 1.0b15 (2009/04/24) ------------------- - Removed lxml extra, as we do no longer depend on it. [malthe] - Make sure the path expression is a simple string, not unicode. [malthe] - Detect path prefix properly for ViewPageTemplateFile usage in doctests. [sidnei] - The ``template`` symbol is already set by the template base class. [malthe] - Set Content-Type header, for backwards compatibility with zope.app.pagetemplate. [sidnei] 1.0b14 (2009/03/31) ------------------- - Updated language adapter to work with 'structure' meta attribute. [malthe] 1.0b13 (2009/03/23) ------------------- - When traversing on dictionaries, only exposes dictionary items (never attributes); this is to avoid ambiguity. [sidnei, malthe] - Path expressions need to pass further path items in reverse order to traversePathElement, because that's what it expects. [sidnei] 1.0b12 (2009/03/09) ------------------- - Insert initial variable context into dynamic scope. The presence of these is expected by many application. [malthe] 1.0b11 (2009/03/05) ------------------- - If a namespace-acquired object provides ``ITraversable``, use path traversal. [malthe] - Implemented TALES function namespaces. [sidnei, malthe] - Catch ``NameError`` in exists-traverser (return false). [malthe] - Catch ``NameError`` in exists-evaluator (return false). [malthe] - If the supplied ``context`` and ``request`` parameters are trivial, get them from the view instance. [malthe] - Expressions in text templates are never escaped. [malthe] - Do not bind template to a trivial instance. [malthe] 1.0b10 (2009/02/24) ------------------- - Fixed exists-traverser such that it always returns a boolean value. [malthe] 1.0b9 (2009/02/19) ------------------ - When evaluating path-expressions at runtime (e.g. the ``path`` method), run the source through the transform first to support dynamic scope. [malthe] 1.0b8 (2009/02/17) ------------------ - Allow attribute access to ``__call__`` method on bound page templates. [malthe] 1.0b7 (2009/02/13) ------------------ - Fixed issue where symbol mapping would not be carried through under a negation (not). [malthe] - Optimize simple case: if path expression is a single path and path is 'nothing' or has 'nocall:', just return value as-is, without going through path_traverse. [sidnei] - Moved evaluate_path and evaluate_exists over from ``five.pt``, adds support for global ``path()`` and ``exists()`` functions for use in ``python:`` expressions (LP #317967). - Added Zope security declaration for the repeat dictionary (tales iterator). [malthe] 1.0b6 (2008/12/18) ------------------ - The 'not' pragma acts recursively. [malthe] 1.0b5 (2008/12/15) ------------------ - View templates now support argument-passing for alternative context and request (for compatibility with ``zope.app.pagetemplate``). [malthe] - Switched off the $-interpolation feature per default; It may be activated on a per-template basis using ``meta:interpolation='true'``. [seletz] - Allow more flexibility in overriding the PathTranslator method. [hannosch] - Removed the forced defaultencoding from the benchmark suite. [hannosch] 1.0b4 (2008/11/19) ------------------ - Split out content provider function call to allow modification through subclassing. [malthe] - Added language negotiation. [malthe] - Simplified template class inheritance. [malthe] - Added support for the question-mark operator in path-expressions. [malthe] - Updated expressions to recent API changes. [malthe] - Added 'exists' and 'not' translators. [malthe] Bug fixes - Adjusted the bigtable benchmark test to API changes. [hannosch] 1.0b3 (2008/11/12) ------------------ - Added ``PageTemplate`` and ``PageTemplateFile`` classes. [malthe] 1.0b2 (2008/11/03) ------------------ Bug fixes - Allow '.' character in content provider expressions. - Allow '+' character in path-expressions. 1.0b1 (2008/10/02) ------------------ Package changes - Split out compiler to "Chameleon" package. [malthe] Backwards incompatibilities - Moved contents of ``z3c.pt.macro`` module into ``z3c.pt.template``. [malthe] - Namespace attribute "xmlns" no longer rendered for templates with no explicit document type. [malthe] - Changes to template method signatures. [malthe] - Engine now expects all strings to be unicode or contain ASCII characters only, unless an encoding is provided. [malthe] - The default path traverser no longer proxies objects. [malthe] - Template output is now always converted to unicode. [malthe] - The ``ViewPageTemplateFile`` class now uses 'path' as the default expression type. [malthe] - The compiler now expects an instantiated parser instance. [malthe] Features - Added expression translator "provider:" (which renders a content provider as defined in the ``zope.contentprovider`` package). [malthe] - Added template API to render macros. [malthe] - Optimized template loader so only a single template is instantiated per file. [malthe] - Made ``z3c.pt`` a namespace package. [malthe] - Added reduce and restore operation to the compilation and rendering flow in the test examples to verify integrity. [malthe] - The ZPT parser now supports prefixed native attributes, e.g.