This module provides helpful functions and classes for use in Python
Scripts. It can be accessed from Python with the statement "import
Products.zms.standard"
str
|
getPRODUCT_HOME()
Returns home-folder of this Product. |
|
|
str
|
getPACKAGE_HOME()
Returns path to lib/site-packages. |
|
|
str
|
getINSTANCE_HOME()
Returns path to Instance |
|
|
MyFile
|
FileFromData(context,
data,
filename='',
content_type=None)
Creates a new instance of a file from given data. |
|
|
MyImage
|
ImageFromData(context,
data,
filename='',
content_type=None)
Creates a new instance of an image from given data. |
|
|
|
set_response_headers(fn,
mt='application/octet-stream',
size=None,
request=None)
Set content-type and -disposition to response-headers. |
|
|
str
|
umlaut_quote(s,
mapping={})
Replace umlauts in s using given mapping. |
|
|
str
|
|
str
|
url_inherit_params(url,
REQUEST,
exclude=[],
sep='&')
Inerits params from request to given url. |
|
|
str
|
string_maxlen(s,
maxlen=20,
etc='...',
encoding=None)
Returns string with specified maximum-length. |
|
|
str
|
url_encode(url)
All unsafe characters must always be encoded within a URL. |
|
|
tuple
|
guess_content_type(filename,
data)
Guess the type of a file based on its filename and the data. |
|
|
|
html_quote(v,
name='(Unknown name)',
md={}) |
|
|
str
|
bin2hex(m)
Returns a string with the hexadecimal representation of integer m. |
|
|
str
|
hex2bin(m)
Converts a hexadecimal-string m to an integer. |
|
|
list
|
|
str
|
|
str
|
encrypt_ordtype(s)
Encrypts given string with entities by random algorithm. |
|
|
int
|
rand_int(n)
Random integer in given range. |
|
|
str
|
|
str
|
getMimeTypeIconSrc(mt)
Returns the absolute-url of an icon representing the specified
MIME-type. |
|
|
|
unencode(p,
enc='utf-8')
Unencodes given parameter. |
|
|
str
|
id_prefix(s)
Returns prefix from identifier (which is the non-numeric part at the
beginning). |
|
|
str
|
id_quote(s,
mapping={'\x20': '_','-': '_','/': '_',})
Converts given string to identifier (removes special-characters and
replaces German umlauts). |
|
|
|
form_quote(text,
REQUEST)
Remove <form>-tags for Management Interface. |
|
|
|
qs_append(qs,
p,
v)
Append to query-string. |
|
|
any
|
nvl(a1,
a2,
n=None)
Returns its first argument if it is not equal to third argument
(None), otherwise it returns its second argument. |
|
|
|
get_session(context)
Get http-session. |
|
|
|
get_session_value(context,
key,
defaultValue=None)
Get http-session-value. |
|
|
|
set_session_value(context,
key,
value)
Set http-session-value. |
|
|
|
triggerEvent(context,
*args,
**kwargs)
Hook for trigger of custom event (if there is one) |
|
|
Bool
|
isManagementInterface(REQUEST)
Returns true if current context is management-interface, false else. |
|
|
Bool
|
isPreviewRequest(REQUEST)
Returns true if current context is preview-request, false else. |
|
|
str
|
|
str
|
http_import(context,
url,
method='GET',
auth=None,
parse_qs=0,
timeout=10,
headers={'Accept': '*/*'})
Send Http-Request and return Response-Body. |
|
|
Bool
|
sendMail(context,
mto,
msubject,
mbody,
REQUEST=None,
mattach=None)
Sends Mail via MailHost. |
|
|
|
extutil()
Returns util to handle zms3.extensions |
|
|
|
getPlugin(context,
path,
options={})
Executes plugin. |
|
|
|
getLog(context)
Get zms_log. |
|
|
str
|
writeStdout(context,
info)
Write to standard-out (only allowed for development-purposes!). |
|
|
str
|
writeLog(context,
info)
Log debug-information. |
|
|
str
|
|
str
|
|
str
|
re_sub(pattern,
replacement,
subject,
ignorecase=False)
Performs a search-and-replace across subject, replacing all matches
of regex in subject with replacement. |
|
|
str
|
re_search(pattern,
subject,
ignorecase=False)
Scan through string looking for a location where the regular
expression pattern produces a match, and return a corresponding
MatchObject instance. |
|
|
str
|
re_findall(pattern,
text,
ignorecase=False)
Return all non-overlapping matches of pattern in string, as a list of
strings. |
|
|
|
|
|
getLangFmtDate(context,
t,
lang=None,
fmt_str='SHORTDATETIME_FMT')
Formats date in locale-format |
|
|
|
getDateTime(t)
Bei Python 2.2 ist der Typ der Objekte des Moduls "time"
nicht mehr "tuple", sondern "time.struct_time". |
|
|
|
stripDateTime(t)
Strips time portion from date-time and returns date. |
|
|
int
|
daysBetween(t0,
t1)
Returns number of days between date t0 and t1. |
|
|
|
compareDate(t0,
t1)
Compares two dates t0 and t1 and returns result. |
|
|
struct_time
|
parseLangFmtDate(s)
Parses a string representing a date by trying a variety of different
parsers. |
|
|
type
|
|
type
|
|
dict
|
|
any
|
operator_getitem(a,
b,
c=None,
ignorecase=True)
Retrieves value for key from python-dictionary. |
|
|
|
|
object
|
|
any
|
|
|
|
string or filestream_iterator
|
localfs_read(filename,
mode='b',
cache='public, max-age=3600',
REQUEST=None)
Reads file from local file-system. |
|
|
|
localfs_write(filename,
v,
mode='b',
REQUEST=None)
Writes file to local file-system. |
|
|
|
localfs_remove(path,
deep=0)
Removes file from local file-system. |
|
|
list
|
localfs_readPath(filename,
data=False,
recursive=False,
REQUEST=None)
Reads path from local file-system. |
|
|
list
|
|
list
|
|
list
|
|
dict
|
dict_list(l)
Converts list to dictionary: key=l[x*2], value=l[x*2+1] |
|
|
list
|
distinct_list(l,
i=None)
Returns distinct values of given field from list. |
|
|
list
|
sort_list(l,
qorder=None,
qorderdir='asc',
ignorecase=1)
Sorts list by given field. |
|
|
list
|
string_list(s,
sep='\n',
trim=True)
Split string by given separator and trim items. |
|
|
Bool
|
is_equal(x,
y)
Compare the two objects x and y for equality. |
|
|
str
|
str_json(i,
encoding='ascii',
errors='xmlcharrefreplace',
formatted=False,
level=0,
allow_booleans=True,
sort_keys=True)
Returns a json-string representation of the object. |
|
|
str
|
str_item(i)
Returns a string representation of the item. |
|
|
list
|
filter_list(l,
i,
v,
o='%')
Filters list by given field. |
|
|
list
|
|
|
sync_list(l,
nl,
i)
Synchronizes list l with new list nl using the column i as
identifier. |
|
|
|
aggregate_list(l,
i)
Aggregates given field in list. |
|
|
str
|
getXmlHeader(encoding='utf-8')
Returns XML-Header (encoding=utf-8) |
|
|
string
|
toXmlString(context,
v,
xhtml=False,
encoding='utf-8')
Serializes value to ZMS XML-Structure. |
|
|
any
|
|
str
|
processData(context,
processId,
data,
trans=None)
Process data with custom transformation. |
|
|
Bool
|
|
any
|
dt_exec(context,
v,
o={})
Try to execute given value. |
|
|
any
|
dt_html(context,
value,
REQUEST)
Execute given DTML-snippet. |
|
|
any
|
dt_py(context,
script,
kw={})
Execute given Python-script. |
|
|
any
|
dt_tal(context,
text,
options={})
Execute given TAL-snippet. |
|
|