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
fe08653e
Commit
fe08653e
authored
Oct 02, 2001
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typo fixes and added examples to TALES docs
parent
da91863a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
19 deletions
+89
-19
lib/python/Products/PageTemplates/help/tales-exists.stx
lib/python/Products/PageTemplates/help/tales-exists.stx
+1
-1
lib/python/Products/PageTemplates/help/tales-path.stx
lib/python/Products/PageTemplates/help/tales-path.stx
+1
-1
lib/python/Products/PageTemplates/help/tales-python.stx
lib/python/Products/PageTemplates/help/tales-python.stx
+61
-9
lib/python/Products/PageTemplates/help/tales-string.stx
lib/python/Products/PageTemplates/help/tales-string.stx
+17
-1
lib/python/Products/PageTemplates/help/tales.stx
lib/python/Products/PageTemplates/help/tales.stx
+9
-7
No files found.
lib/python/Products/PageTemplates/help/tales-exists.stx
View file @
fe08653e
...
@@ -22,6 +22,6 @@ TALES Exists expressions
...
@@ -22,6 +22,6 @@ TALES Exists expressions
</p>
</p>
Note that in this case you can't use the expression,
Note that in this case you can't use the expression,
"not:request/form/number"
, since that expression will be true if
'not:request/form/number'
, since that expression will be true if
the 'number' variable exists and is zero.
the 'number' variable exists and is zero.
\ No newline at end of file
lib/python/Products/PageTemplates/help/tales-path.stx
View file @
fe08653e
...
@@ -50,7 +50,7 @@ TALES Path expressions
...
@@ -50,7 +50,7 @@ TALES Path expressions
then in globals, then in this list, these names act just like
then in globals, then in this list, these names act just like
built-ins in Python; They are always available, but they can be
built-ins in Python; They are always available, but they can be
shadowed by a global or local variable declaration. You can always
shadowed by a global or local variable declaration. You can always
access the built-in names explicit
e
ly by prefixing them with
access the built-in names explicitly by prefixing them with
*CONTEXTS*. (e.g. CONTEXTS/root, CONTEXTS/nothing, etc).
*CONTEXTS*. (e.g. CONTEXTS/root, CONTEXTS/nothing, etc).
Examples
Examples
...
...
lib/python/Products/PageTemplates/help/tales-python.stx
View file @
fe08653e
...
@@ -14,7 +14,24 @@ TALES Python expressions
...
@@ -14,7 +14,24 @@ TALES Python expressions
Security Restrictions
Security Restrictions
XXX
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
underscore.
write limits -- Python expressions cannot change attributes of
Zope objects.
Despite these limits malicious Python expressions can cause
problems. See The Zope Book for more information.
Built-in Functions
Built-in Functions
...
@@ -32,9 +49,9 @@ TALES Python expressions
...
@@ -32,9 +49,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
DTML utility functions are available:
In addition, these
utility functions are available: 'DateTime',
'
DateTime', 'test', 'namespace', 'render'. See XXX for mor
e
'
test', 'same_type'. See XXX for more information on thes
e
information on these
functions.
functions.
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:
...
@@ -53,13 +70,25 @@ TALES Python expressions
...
@@ -53,13 +70,25 @@ TALES Python expressions
Python Modules
Python Modules
string -- XXX
A number of Python modules are available by default. You can
make more modules available. See XXX for more information. You
can access modules either via path expressions (for example
'modules/string/join') or in Python with the 'modules' mapping
object (for example 'modules["string"].join'). Here are the
default modules:
random -- XXX
'string' -- The standard "Python string
module":http://www.python.org/doc/current/lib/module-string.html. Note:
most of the functions in the module are also available as
methods on string objects.
math -- XXX
'random' -- The standard "Python random
module":http://www.python.org/doc/current/lib/module-random.html.
Products.PythonScripts.standard -- XXX
'math' -- The standard "Python math
module":http://www.python.org/doc/current/lib/module-math.html.
'Products.PythonScripts.standard' -- XXX
ZPTUtils.* -- XXX
ZPTUtils.* -- XXX
...
@@ -67,7 +96,30 @@ TALES Python expressions
...
@@ -67,7 +96,30 @@ TALES Python expressions
Examples
Examples
XXX
Basic module usage::
<span tal:replace="python:modules['random'].choice(['one',
'two', 'three', 'four', 'five'])">
a random number between one and five
</span>
String processing (capitalize the user name)::
<p tal:content="python:user.getUserName().capitalize()">
User Name
</p>
Basic math (convert image size to mega bytes)::
<p tal:content="python:image.getSize() / 1048576.0">
12.2323
</p>
String formatting (format a float to two decimal places)::
<p tal:content="python:'%0.2f' % size">
13.56
</p>
See Also
See Also
...
...
lib/python/Products/PageTemplates/help/tales-string.stx
View file @
fe08653e
...
@@ -21,4 +21,20 @@ TALES String expressions
...
@@ -21,4 +21,20 @@ TALES String expressions
Examples
Examples
XXX
Basic string formatting::
\ No newline at end of file
<span tal:replace="string:$this and $that">
this and that
</span>
Variables with longer paths::
<p tal:content="total: ${request/form/total}">
total: 12
</p>
Including a dollar sign::
<p tal:content="cost: $$$cost">
cost: $42.00
</p>
lib/python/Products/PageTemplates/help/tales.stx
View file @
fe08653e
TALES Overview
TALES Overview
The *Template Attribute Language Expression Syntax* (TALES) standard
The *Template Attribute Language Expression Syntax* (TALES) standard
describes expressions that supp
y "TAL":tal.stx and "METAL":metal.stx
describes expressions that supp
ly "TAL":tal.stx and
with data. TALES is *one* possible expression syntax for these
"METAL":metal.stx with data. TALES is *one* possible expression
languages, but they are not bound to this definition. Similarly,
syntax for these languages, but they are not bound to this
TALES could be used in a context having nothing to do with TAL or
definition. Similarly, TALES could be used in a context having
METAL.
nothing to do with TAL or
METAL.
TALES expressions are described below with any delimiter or quote
TALES expressions are described below with any delimiter or quote
markup from higher language layers removed. Here is the basic
markup from higher language layers removed. Here is the basic
...
@@ -72,7 +72,7 @@ TALES Overview
...
@@ -72,7 +72,7 @@ TALES Overview
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 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. In Zope this corresponds
...
@@ -100,7 +100,9 @@ TALES Overview
...
@@ -100,7 +100,9 @@ TALES Overview
See Also
See Also
"TAL overview":tal.stx
"TAL Overview":tal.stx
"METAL Overview":metal.stx
"exists":tales-exists.stx expressions
"exists":tales-exists.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