Email notification¶
Reimplementation of the core CKAN email notifications.
This module reimplements the core CKAN email notifications in order to:
-
Be able to provide more visibility onto what is going on. This includes returning the number of emails being sent.
-
Modify the default implementation in order to not require an active request.
get_notifications ¶
Return any email notifications for the given user since since
.
For example email notifications about activity streams will be returned for
any activities the occurred since since
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_dict |
dictionary
|
a dictionary representing the user, should contain 'id' and 'name' |
required |
since |
datetime after which to return notifications from |
required |
Returns:
Type | Description |
---|---|
list of dicts with keys 'subject' and 'body'
|
a list of email notifications |
Source code in ckanext/saeoss/email_notifications.py
send_notification ¶
Email email_dict
to user
.
Source code in ckanext/saeoss/email_notifications.py
string_to_timedelta ¶
Parse a string s and return a standard datetime.timedelta object.
Handles days, hours, minutes, seconds, and microseconds.
Accepts strings in these formats:
2 days 14 days 4:35:00 (hours, minutes and seconds) 4:35:12.087465 (hours, minutes, seconds and microseconds) 7 days, 3:23:34 7 days, 3:23:34.087465 .087465 (microseconds only)
Raises:
Type | Description |
---|---|
ckan.logic.ValidationError
|
if the given string does not match any of the recognised formats |