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