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
383c4725
Commit
383c4725
authored
Oct 27, 2000
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished off DTML reference.
parent
7d81e970
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
428 additions
and
1 deletion
+428
-1
lib/python/Products/OFSP/help/dtml-funcs.stx
lib/python/Products/OFSP/help/dtml-funcs.stx
+177
-0
lib/python/Products/OFSP/help/dtml-math.stx
lib/python/Products/OFSP/help/dtml-math.stx
+72
-0
lib/python/Products/OFSP/help/dtml-sqlvar.stx
lib/python/Products/OFSP/help/dtml-sqlvar.stx
+1
-1
lib/python/Products/OFSP/help/dtml-string.stx
lib/python/Products/OFSP/help/dtml-string.stx
+150
-0
lib/python/Products/OFSP/help/dtml-whrandom.stx
lib/python/Products/OFSP/help/dtml-whrandom.stx
+28
-0
No files found.
lib/python/Products/OFSP/help/dtml-funcs.stx
0 → 100644
View file @
383c4725
Functions: DTML Functions
DTML utility functions provide some Python built-in functions and
some DTML-specific functions.
Functions
abs(number) -- Return the absolute value of a number. The argument may
be a plain or long integer or a floating point number. If the argument
is a complex number, its magnitude is returned.
chr(integer) -- Return a string of one character whose ASCII code is
the integer i, e.g., chr(97) returns the string 'a'. This is the
inverse of ord(). The argument must be in the range [0..255],
inclusive; ValueError will be raised if i is outside that range.
DateTime() -- Returns a Zope 'DateTime' object given constructor
arguments. See the "DateTime":DateTime.py API reference for more
information on constructor arguments.
divmod(number, number) --Take two numbers as arguments and return a
pair of numbers consisting of their quotient and remainder when using
long division. With mixed operand types, the rules for binary
arithmetic operators apply. For plain and long integers, the result
is the same as (a / b, a % b). For floating point numbers the result
is (q, a % b), where q is usually math.floor(a / b) but may be 1
less than that. In any case q * b + a % b is very close to a, if a %
b is non-zero it has the same sign as b, and 0 <= abs(a % b) <
abs(b).
float(number) -- Convert a string or a number to floating point. If the
argument is a string, it must contain a possibly signed decimal or
floating point number, possibly embedded in whitespace; this
behaves identical to string.atof(x). Otherwise, the argument may be
a plain or long integer or a floating point number, and a floating
point number with the same value (within Python's floating point
precision) is returned.
getattr(object, string) -- Return the value of the named attributed of
object. name must be a string. If the string is the name of one of the
object's attributes, the result is the value of that attribute. For
example, getattr(x, 'foobar') is equivalent to x.foobar. If the named
attribute does not exist, default is returned if provided, otherwise
AttributeError is raised.
getitem(string, boolean) --
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
object's attributes, 0 if not. (This is implemented by calling
getattr(object, name) and seeing whether it raises an exception or
not.)
hash(object) -- Return the hash value of the object (if it has
one). Hash values are integers. They are used to quickly compare
dictionary keys during a dictionary lookup. Numeric values that compare
equal have the same hash value (even if they are of different types,
e.g. 1 and 1.0).
has_key(variable) -- Returns true if the DTML namespace contains the
named variable.
hex(integer) -- Convert an integer number (of any size) to a
hexadecimal string. The result is a valid Python expression. Note: this
always yields an unsigned literal, e.g. on a 32-bit machine, hex(-1)
yields '0xffffffff'. When evaluated on a machine with the same word
size, this literal is evaluated as -1; at a different word size, it
may turn up as a large positive number or raise an OverflowError
exception.
int(number) --- Convert a string or number to a plain integer. If the
argument is a string, it must contain a possibly signed decimal number
representable as a Python integer, possibly embedded in whitespace;
this behaves identical to string.atoi(x[, radix]). The radix parameter
gives the base for the conversion and may be any integer in the range
[2, 36]. If radix is specified and x is not a string, TypeError is
raised. Otherwise, the argument may be a plain or long integer or a
floating point number. Conversion of floating point numbers to integers
is defined by the C semantics; normally the conversion truncates
towards zero.
len(sequence) -- Return the length (the number of items) of an
object. The argument may be a sequence (string, tuple or list) or a
mapping (dictionary).
max(s) -- With a single argument s, return the largest item of a
non-empty sequence (e.g., a string, tuple or list). With more than one
argument, return the largest of the arguments.
min(s) -- With a single argument s, return the smallest item of
a non-empty sequence (e.g., a string, tuple or list). With more than
one argument, return the smallest of the arguments.
namespace() -- Returns a new DTML namespace object. Keyword argument
'name=value' pairs are pushed into the new namespace.
oct(integer) -- Convert an integer number (of any size) to an octal
string. The result is a valid Python expression. Note: this always
yields an unsigned literal, e.g. on a 32-bit machine, oct(-1) yields
'037777777777'. When evaluated on a machine with the same word size,
this literal is evaluated as -1; at a different word size, it may
turn up as a large positive number or raise an OverflowError
exception.
ord(character) -- Return the ASCII value of a string of one
character. E.g., ord('a') returns the integer 97. This is the
inverse of chr().
pow(x, y [,z]) -- Return x to the power y; if z is present, return
x to the power y, modulo z (computed more efficiently than pow(x, y) %
z). The arguments must have numeric types. With mixed operand types,
the rules for binary arithmetic operators apply. The effective operand
type is also the type of the result; if the result is not expressible
in this type, the function raises an exception; e.g., pow(2, -1) or
pow(2, 35000) is not allowed.
range([start,] stop [,step]) -- This is a versatile function to
create lists containing arithmetic progressions.
The arguments must be plain integers. If the
step argument is omitted, it defaults to 1. If the start argument
is omitted, it defaults to 0. The full form returns a
list of plain integers [start, start + step, start + 2 * step,
...]. If step is positive, the last element is the largest
start + i * step less than stop; if step is negative, the last
element is the largest start + i * step greater than stop. step
must not be zero (or else ValueError is raised).
round(x [,n]) -- Return the floating point value x rounded to n
digits after the decimal point. If n is omitted, it defaults to
zero. The result is a floating point number. Values are rounded to the
closest multiple of 10 to the power minus n; if two multiples are
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)'.
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,
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
lists.
str(object) -- Return a string containing a nicely printable
representation of an object. For strings, this returns the string
itself.
test(condition, result [,condition, result]... [,default]) --
Takes one or more condition, result pairs and returns the result
of the first true condition. Only one result is returned, even if
more than one condition is true. If no condition is true and a
default is given, the default is returned. If no condition is true
and there is no default, None is returned.
Attributes
None -- The 'None' object is equivalent to the Python built-in object
'None'. This is usually used to represent a Null or false value.
See Also
"'string' module":dtml-string.stx
"'whrandom' module":dtml-whrandom.stx
"'math' module":dtml-math.stx
"Built-in Python Functions":http://www.python.org/doc/current/lib/built-in-funcs.html
lib/python/Products/OFSP/help/dtml-math.stx
0 → 100644
View file @
383c4725
math: DTML Math Functions
The 'math' module provides trigonometric and other math
functions. It is a standard Python module.
Functions
acos(x) -- Return the arc cosine of *x*.
asin(x) -- Return the arc sine of *x*.
atan(x) -- Return the arc tangent of *x*
atan2(x, y) -- Return *atan(y / x)*.
ceil(x) -- Return the ceiling of *x* as a real.
cos(x) -- Return the cosine of *x*
cosh(x) -- Return the hyperbolic cosine of *x*.
exp(x) -- Return 'e**x'
fabs(x) -- Return the absolute value of the real *x*.
floor(x) -- Return the floor of *x* as a real.
fmod(x, y) -- Return fmod(x, y), as defined by the platform C
library. Note that the Python expression *x % y* may not return the
same result.
fexp(x) -- Return the mantissa and exponent of *x* as the pair (m, e). m
is a float and e is an integer such that 'x == m * 2**e'. If x is zero,
returns (0.0, 0), otherwise 0.5 <= abs(m) < 1.
hypot(x, y) -- Return the Euclidean distance, sqrt(x*x + y*y).
ldexp(x, y) -- Return x * (2**i).
log(x) -- Return the natural logarithm of *x*.
log10(x) -- Return the base-10 logarithm of *x*.
modf(x) -- Return the fractional and integer parts of x. Both results
carry the sign of x. The integer part is returned as a real.
pow(x, y) -- Return *x* to the power of *y*.
sin(x) -- Return the sine of *x*.
sinh(x) -- Return the hyperbolic sine of *x*.
sqrt(x) -- Return the square root of *x*.
tan(x) -- Return the tangent of *x*.
tanh(x) -- Return the hyperbolic tangent of *x*.
Attributes
e -- The mathematical constant *e*.
pi -- The mathematical constant *pi*.
See Also
"Python 'math' module":http://www.python.org/doc/current/lib/module-math.html
lib/python/Products/OFSP/help/dtml-sqlvar.stx
View file @
383c4725
...
@@ -7,7 +7,7 @@ sqlvar: Inserts SQL variables
...
@@ -7,7 +7,7 @@ sqlvar: Inserts SQL variables
'sqlvar' tag syntax::
'sqlvar' tag syntax::
<dml-sqlvar Variable|expr="VariableExpression">
<d
t
ml-sqlvar Variable|expr="VariableExpression">
The 'sqlvar' tag is a singleton. Like the 'var' tag, the 'sqlvar'
The 'sqlvar' tag is a singleton. Like the 'var' tag, the 'sqlvar'
tag looks up a variable and inserts it. Unlike the var tag, the
tag looks up a variable and inserts it. Unlike the var tag, the
...
...
lib/python/Products/OFSP/help/dtml-string.stx
0 → 100644
View file @
383c4725
string: DTML String Functions
The 'string' modules provides string manipulation, conversion, and
searching functions. It is a standard Python module.
Functions
atof(s) -- Convert a string to a floating point number. The string
must have the standard syntax for a floating point literal in Python,
optionally preceded by a sign ("+" or "-"). Note that this behaves
identical to the built-in function float() when passed a string.
atoi(s [,base]) -- Convert string s to an integer in the given
base. The string must consist of one or more digits, optionally
preceded by a sign ("+" or "-"). The base defaults to 10. If it is 0,
a default base is chosen depending on the leading characters of the
string (after stripping the sign): "0x" or "0X" means 16, "0" means
8, anything else means 10. If base is 16, a leading "0x" or "0X" is
always accepted, though not required.
atol(s, [,base]) --Convert string s to a long integer in the given
base. The string must consist of one or more digits, optionally
preceded by a sign ("+" or "-"). The base argument has the same
meaning as for atoi(). A trailing "l" or "L" is not allowed,
except if the base is 0. Note that when invoked without base or
with base set to 10,
capitalize(word) -- Capitalize the first character of the argument.
capwords(s) -- Split the argument into words using split(),
capitalize each word using capitalize(), and join the capitalized
words using join(). Note that this replaces runs of whitespace
characters by a single space, and removes leading and trailing
whitespace.
find(s, sub [,start [,end]]) -- Return the lowest index in s where
the substring sub is found such that sub is wholly contained in
s[start:end]. Return -1 on failure. Defaults for start and end and
interpretation of negative values is the same as for slices.
rfind(s, sub [,start [,end]]) -- Like find() but find the highest
index.
index(s, sub [,start [,end]]) -- Like find() but raise ValueError
when the substring is not found.
rindex(s, sub [,start [,end]]) -- Like rfind() but raise ValueError
when the substring is not found.
count(s, sub [,start [,end]]) -- Return the number of
(non-overlapping) occurrences of substring sub in string
s[start:end]. Defaults for start and end and interpretation of
negative values are the same as for slices.
lower(s) -- Return a copy of s, but with upper case letters
converted to lower case.
makestrans(from, to) -- Return a translation table suitable for passing
to translate() that will map each character in from into the
character at the same position in to; from and to must have the
same length.
split(s, [,sep [,maxsplit]]) -- Return a list of the words of the
string s. If the optional second argument sep is absent or None, the
words are separated by arbitrary strings of whitespace characters
(space, tab, newline, return, formfeed). If the second argument sep
is present and not None, it specifies a string to be used as the word
separator. The returned list will then have one more item than the
number of non-overlapping occurrences of the separator in the
string. The optional third argument maxsplit defaults to 0. If it is
nonzero, at most maxsplit number of splits occur, and the remainder
of the string is returned as the final element of the list (thus, the
list will have at most maxsplit+1 elements).
join(words [,sep]) -- Concatenate a list or tuple of words
with intervening occurrences of sep. The default value for sep
is a single space character. It is always true that
'string.join(string.split(s, sep), sep)' equals s.
lstrip(string) -- Return a copy of s but without leading whitespace
characters.
rstrip(string) -- Return a copy of s but without trailing whitespace
characters.
strip(string) -- Return a copy of s without leading or trailing
whitespace.
swapcase(s) -- Return a copy of s, but with lower case letters
converted to upper case and vice versa.
translate(s, table [,deletechars]) -- Delete all characters from s
that are in deletechars (if present), and then translate the
characters using table, which must be a 256-character string giving
the translation for each character value, indexed by its ordinal.
upper(s) -- Return a copy of string, but with lower case letters
converted to upper case.
ljust(string, width) -- Left-justifies a string in a field of
given width. Returns a string that is at least width characters
wide, created by padding the string with spaces until the given
width. The string is never truncated.
rjust(string, width) -- Right-justifies a string in a field of
given width. Returns a string that is at least width characters
wide, created by padding the string s with spaces until the
given width. The string is never truncated.
center(string, width) -- Centers a string in a field of given
width. Returns a string that is at least width characters wide,
created by padding the string s with spaces until the given
width. The string is never truncated.
zfill(s, width) -- Pad a numeric string on the left with zero
digits until the given width is reached. Strings starting with a sign
are handled correctly.
replace(s, old, new [,maxsplit]) -- Return a copy of string s with
all occurrences of substring old replaced by new. If the optional
argument maxsplit is given, the first maxsplit occurrences are
replaced.
Attributes
digits -- The string '0123456789'
hexdigits -- The string '0123456789abcdefABCDEF'.
letters -- The concatenation of the strings 'lowercase' and 'uppercase' described below.
lowercase -- A string containing all the characters that are considered
lowercase letters. On most systems this is the string
'abcdefghijklmnopqrstuvwxyz'.
octdigits -- The string '01234567'.
uppercase -- A string containing all the characters that are considered
uppercase letters. On most systems this is the string
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
whitespace -- A string containing all characters that are considered
whitespace. On most systems this includes the characters space, tab,
linefeed, return, formfeed, and vertical tab.
See Also
"Python 'string' module":http://www.python.org/doc/current/lib/module-string.html
lib/python/Products/OFSP/help/dtml-whrandom.stx
0 → 100644
View file @
383c4725
whrandom: DTML Pseudo-Random Number Functions
The 'whrandom' 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.
Functions
choice(seq) -- Chooses a random element from the non-empty sequence
'seq' and returns it.
randint(a, b) -- Returns a random integer 'N' such that 'a<=N<=b'.
random() -- Returns the next random floating point number in the range
[0.0 ... 1.0).
seed(x, y, z) -- Initializes the random number generator from the
integers 'x', 'y' and 'z'. When the module is first imported, the random
number is initialized using values derived from the current time.
uniform(a, b) -- Returns a random real number 'N' such that 'a<=N<b'.
See Also
"Python 'whrandom' module":http://www.python.org/doc/current/lib/module-whrandom.html
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