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