Commit 0909a18e authored by Amos Latteier's avatar Amos Latteier

Assorted formatting fixes and typos. Also changed whrandom module to random.

parent 32331d3d
......@@ -46,7 +46,8 @@ functions: DTML Functions
returned if provided, otherwise 'AttributeError' is raised.
getitem(variable, render=0) -- Returns the value of a DTML variable.
If 'render' is true, the variable is rendered.
If 'render' is true, the variable is rendered. See the 'render'
function.
hasattr(object, string) -- The arguments are an object and a
string. The result is 1 if the string is the name of one of the
......@@ -138,13 +139,13 @@ functions: DTML Functions
equally close, rounding is done away from 0 (so e.g. round(0.5) is 1.0
and round(-0.5) is -1.0).
render(object) -- Render 'object'. For DTML objects this renders
(calls) the DTML. For other objects, this is equivalent to
'str(object)'.
render(object) -- Render 'object'. For DTML objects this
evaluates the DTML code with the current namespace. For other
objects, this is equivalent to 'str(object)'.
reorder(s [,with] [,without]) -- Reorder the items in s according
to the order given in with and with items mentioned in without
removed. Items from s not mentioned in with are removed. s,
to the order given in 'with' and without the items mentioned in
'without'. Items from s not mentioned in with are removed. s,
with, and without are all either sequences of strings or
sequences of key-value tuples, with ordering done on the
keys. This function is useful for constructing ordered select
......@@ -199,7 +200,7 @@ functions: DTML Functions
"'string' module":dtml-string.stx
"'whrandom' module":dtml-whrandom.stx
"'random' module":dtml-random.stx
"'math' module":dtml-math.stx
......
......@@ -23,8 +23,8 @@ if: Tests Conditions
If the initial condition is false, each 'elif' condition is tested
in turn. If any 'elif' condition is true, its block is
executed. Finally the optional 'else' condition is tested. If it
is true, the 'else' block is executed. Only one block will be
executed. Finally the optional 'else' block is executed if none of
the 'if' and 'elif' conditions were true. Only one block will be
executed.
Examples
......
......@@ -54,7 +54,8 @@ in: Loops over sequences
Current Item Variables
These variables describe the current item.
These variables describe the
current item.
sequence-item -- The current item.
......@@ -118,13 +119,13 @@ in: Loops over sequences
count-1 degrees of freedom.
variance-n-*variable* -- The variance of an item variable with
count degrees of freedom.
n degrees of freedom.
standard-deviation-*variable* -- The standard-deviation of an
item variable with count-1 degrees of freedom.
standard-deviation-n-*variable* -- The standard-deviation of
an item variable with count degrees of freedom.
an item variable with n degrees of freedom.
Grouping Variables
......@@ -146,7 +147,7 @@ in: Loops over sequences
sequence-step-size -- The batch size.
previous-sequence -- True if the current batch is not the
first one. Note, this variable is only true the first loop
first one. Note, this variable is only true for the first loop
iteration.
previous-sequence-start-index -- The starting index of the
......
whrandom: DTML Pseudo-Random Number Functions
random: DTML Pseudo-Random Number Functions
The 'whrandom' module provides pseudo-random number functions. With
The 'random' module provides pseudo-random number functions. With
it, you can generate random numbers and select random elements from
sequences. This module is a standard Python module.
......@@ -22,7 +22,7 @@ whrandom: DTML Pseudo-Random Number Functions
See Also
"Python 'whrandom' module":http://www.python.org/doc/current/lib/module-whrandom.html
"Python 'random' module":http://www.python.org/doc/current/lib/module-whrandom.html
......@@ -11,8 +11,7 @@ return: Returns data
Stops execution of DTML and returns a variable or expression. The
DTML output is not returned. Usually a return expression is more
useful than a return variable. Python Methods largely obsolete
this tag.
useful than a return variable. Scripts largely obsolete this tag.
Examples
......
......@@ -102,7 +102,7 @@ tree: Inserts a tree widget
Examples
Display a rooted in the current object::
Display a tree rooted in the current object::
<dtml-tree>
<dtml-var title_or_id>
......
......@@ -18,12 +18,12 @@ try: Handles exceptions
The 'try' tag encloses a block in which exceptions can be caught and
handled. There can be one or more 'except' tags that handles
zero or more exceptions. If a 'except' tag does not specify an
zero or more exceptions. If an 'except' tag does not specify an
exception, then it handles all exceptions.
When an exception is raised, control jumps to the first 'except'
tag that handles the exception. If there is no 'except' tag to
handled the exception, then the exception is raised normally.
handle the exception, then the exception is raised normally.
If no exception is raised, and there is an 'else' tag, then the
'else' tag will be executed after the body of the 'try' tag.
......
......@@ -105,12 +105,12 @@ var: Inserts a variable
<dtml-var standard_html_header>
Truncation. Suppose *colors* is the string 'red yellow green',
then::
Truncation::
<dtml-var colors size=10 etc=", etc.">
will produce the output::
will produce the following output if *colors* is the string 'red
yellow green'::
red yellow, etc.
......@@ -127,13 +127,15 @@ var: Inserts a variable
<a href="&dtml-link;">Link</a>
Inserting a variable using entity syntax with attributes::
Inserting a link to a document 'doc', using entity syntax with
attributes::
<a href="&dtml.url-doc;"><dtml-var doc fmt="title_or_id"></a>
This creates an HTML link to an object using its URL and
title. This example calls the object's 'absolute_url' method for
the URL and its 'title_or_id' method for the title.
the URL (using the 'url' attribute) and its 'title_or_id' method
for the title.
......
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