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
Hide 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
</p>
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.
\ No newline at end of file
lib/python/Products/PageTemplates/help/tales-path.stx
View file @
fe08653e
...
...
@@ -50,7 +50,7 @@ TALES Path expressions
then in globals, then in this list, these names act just like
built-ins in Python; They are always available, but they can be
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).
Examples
...
...
lib/python/Products/PageTemplates/help/tales-python.stx
View file @
fe08653e
...
...
@@ -14,7 +14,24 @@ TALES Python expressions
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
...
...
@@ -32,9 +49,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
DTML utility functions are available:
'
DateTime', 'test', 'namespace', 'render'. See XXX for mor
e
information on these
functions.
In addition, these
utility functions are available: 'DateTime',
'
test', 'same_type'. See XXX for more information on thes
e
functions.
Finally, these functions are available in Python expressions,
but not in Python-based scripts:
...
...
@@ -53,13 +70,25 @@ TALES Python expressions
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:
'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.
random -- XXX
'random' -- The standard "Python random
module":http://www.python.org/doc/current/lib/module-random.html.
math -- XXX
'math' -- The standard "Python math
module":http://www.python.org/doc/current/lib/module-math.html.
Products.PythonScripts.standard
-- XXX
'Products.PythonScripts.standard'
-- XXX
ZPTUtils.* -- XXX
...
...
@@ -67,7 +96,30 @@ TALES Python expressions
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
...
...
lib/python/Products/PageTemplates/help/tales-string.stx
View file @
fe08653e
...
...
@@ -21,4 +21,20 @@ TALES String expressions
Examples
XXX
\ No newline at end of file
Basic string formatting::
<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
The *Template Attribute Language Expression Syntax* (TALES) standard
describes expressions that supp
y "TAL":tal.stx and "METAL":metal.stx
with data. TALES is *one* possible expression syntax for these
languages, but they are not bound to this definition. Similarly,
TALES could be used in a context having nothing to do with TAL or
METAL.
describes expressions that supp
ly "TAL":tal.stx and
"METAL":metal.stx with data. TALES is *one* possible expression
syntax for these languages, but they are not bound to this
definition. Similarly, TALES could be used in a context having
nothing to do with TAL or
METAL.
TALES expressions are described below with any delimiter or quote
markup from higher language layers removed. Here is the basic
...
...
@@ -72,7 +72,7 @@ TALES Overview
attributes of the current statement tag.
- *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.
- *root* - the system's top-most object. In Zope this corresponds
...
...
@@ -100,7 +100,9 @@ TALES Overview
See Also
"TAL overview":tal.stx
"TAL Overview":tal.stx
"METAL Overview":metal.stx
"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