Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
9d57e3e8
Commit
9d57e3e8
authored
Sep 25, 2001
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progress on tales reference.
parent
55a6f28e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
32 deletions
+117
-32
lib/python/Products/PageTemplates/help/tales-exists.stx
lib/python/Products/PageTemplates/help/tales-exists.stx
+27
-0
lib/python/Products/PageTemplates/help/tales-no-call.stx
lib/python/Products/PageTemplates/help/tales-no-call.stx
+30
-3
lib/python/Products/PageTemplates/help/tales-not.stx
lib/python/Products/PageTemplates/help/tales-not.stx
+11
-1
lib/python/Products/PageTemplates/help/tales-path.stx
lib/python/Products/PageTemplates/help/tales-path.stx
+14
-4
lib/python/Products/PageTemplates/help/tales.stx
lib/python/Products/PageTemplates/help/tales.stx
+35
-24
No files found.
lib/python/Products/PageTemplates/help/tales-exists.stx
0 → 100644
View file @
9d57e3e8
TALES Exists expressions
Syntax
Exists expression syntax::
exists_expressions ::= 'exists:' path_expression
Description
Exists expressions test for the existence of paths. An exists
expression returns true when the path expressions following it
expression returns a value. It is false when the path expression
cannot locate an object.
Examples
Testing for the existence of a form variable::
<p tal:condition="not:exists:request/form/number">
Please enter a number between 0 and 5
</p>
Note that in this case you can't use the expression,
"not:request/form/number", since that expression will be true if
the 'number' variable exists and is zero.
\ No newline at end of file
lib/python/Products/PageTemplates/help/tales-no-call.stx
View file @
9d57e3e8
TALES No
call expressions
TALES No
-
call expressions
Syntax
Syntax
XXX
No-call expression syntax::
nocall_expression ::= 'no-call:' expression
Description
Description
XXX
No-call expressions avoid rendering the results of another
\ No newline at end of file
expression.
An ordinary path expression tries to render the object that it
fetches. This means that if the object is a function, Script,
Method, or some other kind of executable thing, then expression
will evaluate to the result of calling the object. This is
usually what you want, but not always. For example, if you want
to put a DTML Document into a variable so that you can refer to
its properties, you can't use a normal path expression because it
will render the Document into a string.
Examples
Using no-call to get the properties of a document::
<span tal:define="doc nocall:here/aDoc"
tal:content="string:${doc/getId}: ${doc/title}">
Id: Title</span>
Using no-call expressions on a functions::
<p tal:define="join nocall:modules/string/join">
This example defines a variable 'join' which is bound to the
'string.join' function.
lib/python/Products/PageTemplates/help/tales-not.stx
View file @
9d57e3e8
...
@@ -2,7 +2,9 @@ TALES Not expressions
...
@@ -2,7 +2,9 @@ TALES Not expressions
Syntax
Syntax
XXX
Not expression syntax::
not_expression ::= 'not:' expression
Description
Description
...
@@ -28,3 +30,11 @@ TALES Not expressions
...
@@ -28,3 +30,11 @@ TALES Not expressions
Zope considers all objects not specifically listed above as
Zope considers all objects not specifically listed above as
*false* (including negative numbers) to be *true*.
*false* (including negative numbers) to be *true*.
Examples
Testing a sequence::
<p tal:condition="not:here/objectIds">
There are no contained objects.
</p>
lib/python/Products/PageTemplates/help/tales-path.stx
View file @
9d57e3e8
...
@@ -4,9 +4,9 @@ TALES Path expressions
...
@@ -4,9 +4,9 @@ TALES Path expressions
Path expression syntax::
Path expression syntax::
PathExpr ::= Path [ '|' Path ]*
PathExpr ::= Path [ '|' Path ]*
Path ::= variable [ '/' URL_Segment ]*
Path ::= variable [ '/' URL_Segment ]*
variable ::= Name
variable ::= Name
Description
Description
...
@@ -55,7 +55,17 @@ TALES Path expressions
...
@@ -55,7 +55,17 @@ TALES Path expressions
Examples
Examples
XXX
Inserting a cookie variable or a property::
<span tal:replace="request/cookies/pref | here/pref">
preference
</span>
Inserting the user name::
<p tal:content="user/getUserName">
User name
</p>
...
...
lib/python/Products/PageTemplates/help/tales.stx
View file @
9d57e3e8
...
@@ -36,7 +36,9 @@ TALES Overview
...
@@ -36,7 +36,9 @@ TALES Overview
These are the TALES expression types supported by Zope:
These are the TALES expression types supported by Zope:
* "no-call":tales-no-call.stx expression - don't call a value
* "exists":tales-exists.stx expressions - test existence of a value
* "no-call":tales-no-call.stx expressions - don't call a value
* "not:tales-not.stx expressions - negate a value
* "not:tales-not.stx expressions - negate a value
...
@@ -49,41 +51,48 @@ TALES Overview
...
@@ -49,41 +51,48 @@ TALES Overview
Built-in Names
Built-in Names
These are the names that are built-in the TALES in Zope:
These are the names that are built-in the TALES in Zope:
- *nothing* - special singleton value used by TAL to represent
- *nothing* - special singleton value used by TAL 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 singleton value used by TAL to specify that
existing text should not be replaced.
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.
- *options* - the *keyword* arguments passed to the template. These
are generally available when a template is called from Python,
rather than from the web.
- *repeat* - the 'repeat' variables (see RepeatVariable).
- *repeat* - the 'repeat' variables see the
"tal:repeat":tal-repeat.stx documentation.
- *attrs* - a dictionary containing the initial values of the
- *attrs* - a dictionary containing the initial values of the
attributes of the current statement tag.
attributes of the current statement tag.
- *CONTEXTS* - the list of standard names (this list). This can be
- *CONTEXTS* - the list of standard names (this list). This can be
used to access a builtin variable that has been hidden by a local
used to access a builtin 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.
- *root* - the system's top-most object. In Zope this corresponds
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.
- *container* - the template's container object. In Zope this is
the folder in which the template is located.
- *template* - the template itself.
- *template* - the template itself.
- *request* - the publishing request object.
- *request* - the publishing request object.
- *user* - the authenticated user object.
- *user* - the authenticated user object.
- *modules* - a collection through which all Python modules and
- *modules* - a collection through which all Python modules and
packages can be accessed. Some or many of these may not be
packages can be accessed. Some or many of these may not be
usable in TALES, however, depending on the security policies
usable in TALES, however, depending on the security policies
of the template's implementation.
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
...
@@ -93,7 +102,9 @@ TALES Overview
...
@@ -93,7 +102,9 @@ TALES Overview
"TAL overview":tal.stx
"TAL overview":tal.stx
"no-call":tales-no-call.stx expression
"exists":tales-exists.stx expressions
"no-call":tales-no-call.stx expressions
"not:tales-not.stx expressions
"not:tales-not.stx expressions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment