• Home
  • API Documentation
  • wte.util – Utility functions

wte.util – Utility functions¶

The util module provides various utility objects and functions.

wte.util.ordered_counted_set(items)[source]¶

Returns a list of (item, count) tuples derived from the items. Each unique item is listed once with the number of times it appears in the items The unique items are ordered in the same order in which they appear in the items.

Parameters:items (list()) – The list of items to create the ordered, counted set for
Returns:A list of unique items with their frequency counts
R_type:list() of tuple()
wte.util.send_email(request, recipient, sender, subject, text)[source]¶

Sends an e-mail based on the settings in the configuration file. If the configuration does not have e-mail settings or if there is an exception sending the e-mail, then it will log an error.

Parameters:
  • request (pyramid.request.Request) – The current request used to access the settings
  • recipient (unicode) – The recipient’s e-mail address
  • sender (unicode) – The sender’s e-mail address
  • subject (unicode) – The e-mail’s subject line
  • text (unicode) – The e-mail’s text body content
wte.util.timing_tween_factory(handler, registry)[source]¶

Pyramid tween factory that logs the time taken for a request. Will not time static requests.

wte.util.version()[source]¶

Return the current application version.

  • wte.text_formatter.docutils_ext
  • wte.views – View handlers