gs.group.messages.topic.digest.send

The gs.group.messages.topic.digest.send product provides the senddigest script. This script is used to send out the daily digest of topics once a day, and is normally called by cron(8).

The gs.group.topic.digest.send code does only triggers two web-hooks. Both these hooks are provided by the gs.group.messages.topic.digest.base product [1].

Contents:

senddigest

Synopsis

senddigest [-h] [-c <CONFIG>] [-i <INSTANCE>] [-v] url

Description

Usually senddigest is called by cron(8) once a day to send the daily digest of topics from GroupServer to all the members of all the groups whose email settings are set to digest.

Positional arguments

url

The URL for the GroupServer site.

Optional arguments

-h, --help

Show this help message and exit

-c <CONFIG>, --config <CONFIG>

The name of the GroupServer configuration file (default INSTANCE_HOME/etc/gsconfig.ini) that contains the token that will be used to authenticate the script when it tries to send the digests.

-i <INSTANCE>, --instance <INSTANCE>

The identifier of the GroupServer instance configuration to use (default default).

-v, --verbose

Provide verbose output. The default is to provide no output (no news is good news).

Returns

The script returns 0 on success, or non-zero on error. In the case of an error, senddigest follows the convention specified in /usr/include/sysexits.h.

gs.group.topic.digest.send code

The code for the script that sends out the digest works in two main stages: first it gets the list of groups, and then it sends a digest. Both raise the same exceptions.

The list of groups

The list of groups is retrieved using a web-hook that returns a list of groups as a JSON blob. The DIGEST_GROUPS_URI specifies the location of the web-hook, relative to the root of the site, while the get_digest_groups() function retrieves the list of groups.

gs.group.messages.topic.digest.send.script.DIGEST_GROUPS_URI = u'/gs-group-messages-topic-digest-groups.html'

The URL of the web-hook that returns (as a JSON blob) the list of groups that need a digest.

gs.group.messages.topic.digest.send.script.get_digest_groups(hostname, token)[source]

Get the list of groups to send the digest to.

Parameters:
  • hostname (str) – The name of the host to use.
  • token (str) – The token to use for authentication.
Raises:

NotOk – When the page does not return an HTTP 200 status code.

Returns:

A list of 2-tuples (siteId, groupId), sorted alphabetically

Return type:

tuple

Sending a digest

The digest is actually send by a web-hook. This hook is located at SEND_DIGEST_URI and is triggered by the send_digest() function.

gs.group.messages.topic.digest.send.script.SEND_DIGEST_URI = u'/gs-group-messages-topic-digest-send.html'

The URL of the web-hook used to send a digest to a group

gs.group.messages.topic.digest.send.script.send_digest(hostname, siteId, groupId, token)[source]

Send a digest for a particular group

Parameters:
  • hostname (str) – The name of the host to use.
  • siteId (str) – The identifier for the site that contains the group.
  • groupId (str) – The identifier for the group.
  • token (str) – The token to use for authentication.
Raises:

NotOk – When the page does not return an HTTP 200 status code.

Exceptions

class gs.group.messages.topic.digest.send.script.NotOk[source]

Raised when a web-hook does not return a 200 status code

Changelog

3.1.1 (2015-06-01)

  • Fixing a link in the documentation

3.1.0 (2015-04-20)

  • Added the --verbose (-v) flag
  • Following the split between getting the list of groups, and sending a digest
  • Moved the documentation to Read the Docs

3.0.0 (2015-02-26)

2.1.0 (2014-03-26)

  • Making the name of the configuration file an optional argument to the script
  • Switching to Unicode literals

2.0.0 (2012-11-30)

Initial import. Prior to the creation of this product the trigger for sending digests was part of Products.XWFMailingListManager.

Indices and tables