WebUtils.Funcs | index /usr/local/share/webware/WebUtils/Funcs.py

`WebUtils.Funcs
This module provides some basic functions that are useful
in HTML and web development.
You can safely import * from WebUtils.Funcs if you like.`

Functions

``

htmlDecode(s, codes=(('"', '&quot;'), ('>', '&gt;'), ('<', '&lt;'), ('&', '&amp;')))
  `Return the ASCII decoded version of the given HTML string.
  This does NOT remove normal HTML tags like <p>.
  It is the inverse of htmlEncode().
  The optional 'codes' parameter allows passing custom translations.`

htmlEncode(what, codes=(('&', '&amp;'), ('<', '&lt;'), ('>', '&gt;'), ('"', '&quot;')))
  `Return the HTML encoded version of the given object.
  The optional 'codes' parameter allows passing custom translations.`

htmlEncodeStr(s, codes=(('&', '&amp;'), ('<', '&lt;'), ('>', '&gt;'), ('"', '&quot;')))
  `Return the HTML encoded version of the given string.
  This is useful to display a plain ASCII text string on a web page.
  The optional 'codes' parameter allows passing custom translations.`

htmlForDict(d, addSpace=None, filterValueCallBack=None, maxValueLength=None, topHeading=None, isEncoded=None)
  `Return an HTML string with a table where each row is a key-value pair.`

normURL(path)
  `Normalizes a URL path, like os.path.normpath.
  Acts on a URL independant of operating system environment.`

requestURI(env)
  `Return the request URI for a given CGI-style dictionary.
  Uses REQUEST_URI if available, otherwise constructs and returns it
  from SCRIPT_URL, SCRIPT_NAME, PATH_INFO and QUERY_STRING.`

urlDecode = unquote_plus(s)
  `unquote('%7e/abc+def') -> '~/abc def'`

urlEncode = quote_plus(s, safe='')
  `Quote the query fragment of a URL; replacing ' ' with '+'`

Data
`` |  | __all__ = ['htmlEncode', 'htmlEncodeStr', 'htmlDecode', 'urlEncode', 'urlDecode', 'htmlForDict', 'requestURI', 'normURL']