Commit 5b353c78 authored by Evan Simpson's avatar Evan Simpson

Fixes to help

parent ace9a7e9
......@@ -27,6 +27,6 @@ metal:define-macro - Define a macro
See Also
"metal:use-macro":metal-use-macro.stx"
"metal:use-macro":metal-use-macro.stx
"metal:define-slot":metal-define-slot.stx
......@@ -12,7 +12,7 @@ metal:define-slot - Define a macro customization point
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 decides not to customize the macro when using it.
you decide not to customize the macro when using it.
The 'metal:define-slot' statement must be used inside a
'metal:define-macro' statement.
......
......@@ -16,8 +16,8 @@ metal:fill-slot - Customize a macro
Slot names must be unique within a macro.
If the named slot does not exist within the macro, Zope will raise
an error.
If the named slot does not exist within the macro, the slot
contents will be silently dropped.
Examples
......@@ -35,4 +35,4 @@ metal:fill-slot - Customize a macro
See Also
"metal:define-slot":metal-define-slot.stx
\ No newline at end of file
"metal:define-slot":metal-define-slot.stx
......@@ -47,5 +47,5 @@ metal:use-macro - Use a macro
"metal:define-macro":metal-define-macro.stx
"metal:use-slot":metal-use-slot.stx
"metal:fill-slot":metal-fill-slot.stx
......@@ -28,12 +28,12 @@ METAL Overview
* "metal:define-macro":metal-define-macro.stx - Define a macro.
* "metal:use-macro":metal-use-macro.stx" - Use a macro.
* "metal:use-macro":metal-use-macro.stx - Use a macro.
* "metal:define-slot":metal-define-slot.stx - Define a macro
* customization point.
customization point.
* "metal:use-slot":metal-use-slot.stx - Customize a macro.
* "metal:fill-slot":metal-fill-slot.stx - Customize a macro.
Although METAL does not define the syntax of expression
non-terminals, leaving that up to the implementation, a canonical
......@@ -48,11 +48,11 @@ METAL Overview
"metal:define-macro":metal-define-macro.stx
"metal:use-macro":metal-use-macro.stx"
"metal:use-macro":metal-use-macro.stx
"metal:define-slot":metal-define-slot.stx
"metal:use-slot":metal-use-slot.stx
"metal:fill-slot":metal-fill-slot.stx
\ No newline at end of file
......@@ -15,7 +15,7 @@ tal:attributes - Replace element attributes
Description
The 'tal:attributes' statement replaces the value of an attribute
(or create an attribute) with a dynamic value. You can qualify an
(or creates an attribute) with a dynamic value. You can qualify an
attribute name with a namespace prefix, for example 'html:table', if
you are generating an XML document with multiple namespaces. The
value of each expression is converted to a string, if necessary.
......@@ -28,23 +28,7 @@ tal:attributes - Replace element attributes
which some attributes are deleted and others are left alone.
If you use 'tal:attributes' on an element with an active
'tal:replace' command, the implementation may ignore the
'tal:attributes' statement. If it does not, the replacement must
use the 'structure' type, the structure returned by the expression
must yield at least one element, and the attributes will be replaced
on the first such element only. For example::
<span tal:replace="structure an_image" tal:attributes="border string:1">
May result in either::
<img src="foo.png">
or::
<img src="foo.png" border="1">
*Note: Zope will return the second result*
'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
......
......@@ -8,14 +8,13 @@ tal:condition - Conditionally insert or remove an element
Description
The 'tal:condition' statement includes a particular part of a
template only under certain conditions, and omits it otherwise. If
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 document. It is up to the interface
between TAL and the expression engine to determine the value of
*true* and *false*. For these purposes, the value *nothing* is
false, and *default* has the same effect as returning a true value.
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: Zope considers missing variables, None, zero, empty strings,
and empty sequences false; all other values are true.*
......
......@@ -4,7 +4,7 @@ tal:omit-tag - Remove an element, leaving its contents
'tal:omit-tag' syntax::
argument ::= [expression]
argument ::= [ expression ]
Description
......@@ -40,4 +40,4 @@ tal:omit-tag - Remove an element, leaving its contents
tal:omit-tag="">
<p tal:content="n">1</p>
</span>
\ No newline at end of file
......@@ -15,7 +15,7 @@ tal:on-error - Handle errors
'tal:on-error' found is invoked. It is treated as a 'tal:content'
statement.
A local variable, 'error' is set. This variable has these
A local variable 'error' is set. This variable has these
attributes:
'type' -- the exception type
......
......@@ -4,11 +4,11 @@ TALES Nocall expressions
Nocall expression syntax::
nocall_expression ::= 'nocall:' expression
nocall_expression ::= 'nocall:' path_expression
Description
Nocall expressions avoid rendering the results of another
Nocall expressions avoid rendering the results of a path
expression.
An ordinary path expression tries to render the object that it
......
......@@ -35,8 +35,7 @@ TALES Path expressions
Once a path has been successfully traversed, the resulting object
is the value of the expression. If it is a callable object, such
as a method or template, it is called. The semantics of traversal
(and what it means to be callable) are implementation-dependent.
as a method or template, it is called.
If a traversal step fails, evaluation immediately proceeds to the next
path. If there are no further paths, an error results.
......
......@@ -4,7 +4,7 @@ TALES Python expressions
Python expression syntax::
XXX
any valid Python language expression
Description
......@@ -17,11 +17,6 @@ TALES Python expressions
Python expressions are subject to the same security restrictions
as Python-based scripts. These restrictions include:
loop limits -- Python expressions cannot create infinite loops.
import limits -- Python expressions can only access some Python
modules. See below for details.
access limits -- Python expressions are subject to Zope
permission and role security restrictions. In addition,
expressions cannot access objects whose names begin with
......@@ -36,7 +31,7 @@ TALES Python expressions
Built-in Functions
Python expressions have the same built-ins as Python-based
scripts with a few additions.
Scripts with a few additions.
These standard Python built-ins are available: 'None', 'abs',
'apply', 'callable', 'chr', 'cmp', 'complex', 'delattr',
......@@ -49,9 +44,9 @@ TALES Python expressions
keep them from generating very large numbers and sequences. This
limitation helps protect against denial of service attacks.
In addition, these utility functions are available: 'DateTime',
'test', 'same_type'. See XXX for more information on these
functions.
In addition, these utility functions are available:
"DateTime":/Control_Panel/Products/OFSP/Help/DateTime.py,
'test', and 'same_type'.
Finally, these functions are available in Python expressions,
but not in Python-based scripts:
......
......@@ -14,7 +14,8 @@ TALES String expressions
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
'${name}', where 'name' is a "path expression":tales-path.stx.
'${path}', where 'name' is a variable name, and 'path' is a
"path expression":tales-path.stx.
The escaped string value of the path expression is inserted into
the string. To prevent a '$' from being interpreted this way, it
must be escaped as '$$'.
......@@ -24,10 +25,10 @@ TALES String expressions
Basic string formatting::
<span tal:replace="string:$this and $that">
this and that
Spam and Eggs
</span>
Variables with longer paths::
Using paths::
<p tal:content="total: ${request/form/total}">
total: 12
......
......@@ -36,36 +36,36 @@ TALES Overview
These are the TALES expression types supported by Zope:
* "exists":tales-exists.stx expressions - test existence of a value
* "path":tales-path.stx expressions - locate a value by its path.
* "nocall":tales-nocall.stx expressions - don't call a value
* "exists":tales-exists.stx expressions - test whether a path is valid.
* "not:tales-not.stx expressions - negate a value
* "nocall":tales-nocall.stx expressions - locate an object by its path.
* "not":tales-not.stx expressions - negate an expression
* "string":tales-string.stx expressions - format a string
* "path":tales-path.stx expressions - locate an object
* "python":tales-python.stx expressions - execute a Python
expression
Built-in Names
These are the names that are built-in the TALES in Zope:
These are the names that always available to TALES expressions in Zope:
- *nothing* - special singleton value used by TAL to represent
- *nothing* - special value used by to represent
a *non-value* (e.g. void, None, Nil, NULL).
- *default* - special singleton value used by TAL to specify that
- *default* - special value used to specify that
existing text should not be replaced. See the documentation for
individual TAL statements for details on how they interpret
*default*.
- *options* - the *keyword* arguments passed to the template. These
are generally available when a template is called from Python,
rather than from the web.
are generally available when a template is called from Methods
and Scripts, rather than from the web.
- *repeat* - the 'repeat' variables see the
- *repeat* - the 'repeat' variables; see the
"tal:repeat":tal-repeat.stx documentation.
- *attrs* - a dictionary containing the initial values of the
......@@ -75,13 +75,11 @@ TALES Overview
used to access a built-in variable that has been hidden by a local
or global variable with the same name.
- *root* - the system's top-most object. In Zope this corresponds
to the root folder.
- *root* - the system's top-most object: the Zope root folder.
- *here* - the object to which the template is being applied.
- *container* - the template's container object. In Zope this is
the folder in which the template is located.
- *container* - The folder in which the template is located.
- *template* - the template itself.
......@@ -89,10 +87,9 @@ TALES Overview
- *user* - the authenticated user object.
- *modules* - a collection through which all Python modules and
packages can be accessed. Some or many of these may not be
usable in TALES, however, depending on the security policies
of the template's implementation.
- *modules* - a collection through which Python modules and
packages can be accessed. Only modules which are approved by
the Zope security policy can be accessed.
Note the names 'root', 'here', 'container', 'template', 'request',
'user', and 'modules' are optional names supported by Zope, but
......@@ -115,4 +112,4 @@ TALES Overview
"path":tales-path.stx expressions
"python":tales-python.stx expressions
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment