This module is automatically made available inside the template script as h. And the entire namespace is accessible as h.<attr>.
1 2 3 4 | <head>
<body>
${ h.parsecsv( 'one, two, three' ) }
${ h.parsecsvlines( 'one, \n two, three' ) }
|
Instead of importing python stdlib modules directly in template scripts it is better to access them via this module, so that in future when sandboxing feature is added, your scripts can remain compatible.
Parse the asset specification spec in the context of package name pname. If pname is package object, it is resolved as pname.__name__. Return a tuple of (packagename, filename), where packagename is the name of the package relative to which the file asset filename is located.
Use the dictionary of papackages, gathered during platform boot time by calling package() entrypoint and convert abspath to asset-specification format.
Convert assert sepcification into absolute path. if pname is supplied, it will be used to parse the asset-spec
Filter settings keys sett.keys() starting with prefix and return a dictionary of corresponding options. Prefix is pruned of from returned settings’ keys.
Convert pluginname to plugin section name in ini-file. For Eg, for plugin-name httpepollserver, will return plugin:httpepollserver.
Reverse of plugin2sec().
JSON-encodes the given Python object. If encoding is supplied, then the resulting json encoded string will be converted to bytes and return the same, otherwise, json encodied string is returned as is.
Convert json encoded value to Python object. If encoding is not supplied value is assumed to be in string, otherwise, value is expected in bytes and converted to string.
Return the python object.
Parse a single line of comma separated values, into a list of strings
Parse a multi-line text where each line contains comma separated values.
Convert a string representation of boolean value to boolean type.
Convert string representation of integer value to integer type.
Convert string representation of float value to floating type.
Return the doc-string for the object.
If os.urandom is available, this method does the same thing as random.seed ! (at least as of python 2.6). If os.urandom is not available, we mix in the pid in addition to a timestamp.
For a list of dictionaries in args return a new dictionary containing super-imposed key,value pairs from args
Iterate over lst until pred is True and return only the iterated elements.
Iterate over lst until pred is True and return the remaining elements in lst.
Flatten nested list lst into a flat list.
Bases: builtins.dict
A collection of configuration settings. When a fresh key, a.k.a configuration parameter is added to this dictionary, it can be provided as ConfigItem object or as a dictionary containing key,value pairs similar to ConfigItem.
Used as return type for default_settings() method specified in pluggdapps.plugin.ISettings