.. You should enable this project on travis-ci.org and coveralls.io to make
these badges work. The necessary Travis and Coverage config files have been
generated for you.
.. image:: https://travis-ci.org/davidread/ckanext-subscribe.svg?branch=master
:target: https://travis-ci.org/davidread/ckanext-subscribe
.. image:: https://coveralls.io/repos/github/davidread/ckanext-subscribe/badge.svg?branch=master
:target: https://coveralls.io/github/davidread/ckanext-subscribe?branch=master
.. image:: https://img.shields.io/pypi/v/ckanext-subscribe.svg
:target: https://pypi.org/project/ckanext-subscribe/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/pyversions/ckanext-subscribe.svg
:target: https://pypi.org/project/ckanext-subscribe/
:alt: Supported Python versions
.. image:: https://img.shields.io/pypi/status/ckanext-subscribe.svg
:target: https://pypi.org/project/ckanext-subscribe/
:alt: Development Status
.. image:: https://img.shields.io/pypi/l/ckanext-subscribe.svg
:target: https://pypi.org/project/ckanext-subscribe/
:alt: License
=================
ckanext-subscribe
=================
CKAN extension that allows users to subscribe to dataset/organization/group
updates WITHOUT requiring them to login.
This feature is complementary to CKAN's existing "Follow" feature, which allows
logged in users to subscribe to get update emails. Log-in can be a barrier to
casual interest in say a handful of datasets. Generating and storing a password
is a burden on the user, and for casual use just using temporary email links,
as in this extension, is more appropriate.
.. image:: doc/sign-up.png
More screenshots: https://github.com/davidread/ckanext-subscribe/tree/master/doc
------------
Requirements
------------
Compatibility with core CKAN versions:
=============== =============
CKAN version Compatibility
=============== =============
2.6 and earlier no
2.7 yes
2.8 yes
2.9 not yet
=============== =============
------------
Installation
------------
.. Add any additional install steps to the list below.
For example installing any non-Python dependencies or adding any required
config settings.
To install ckanext-subscribe:
1. Activate your CKAN virtual environment, for example::
. /usr/lib/ckan/default/bin/activate
2. Install the ckanext-subscribe Python package into your virtual environment::
pip install ckanext-subscribe
3. Add ``subscribe`` to the ``ckan.plugins`` setting in your CKAN
configuration file (by default the config file is located at
``/etc/ckan/default/production.ini``).
4. Make sure that ``ckan.site_url`` is set correctly in the ``[app:main]``
section of your CKAN configuration file. This is used to generate links in
the bodies of the notification emails. For example::
ckan.site_url = https://example.com
5. Make sure that ``smtp.mail_from`` is set correctly in the ``[app:main]``
section of your CKAN configuration file. This is the email address that
CKAN's email notifications will appear to come from. For example::
smtp.mail_from = info@example.com
This is combined with your ``ckan.site_title`` to form the ``From:`` header
of the email that are sent, for example::
From: Sunnyville Open Data <info@example.com>
If you would like to use an alternate reply address, such as a "no-reply"
address, set ``smtp.reply_to`` in the ``[app:main]``
section of your CKAN configuration file. For example::
smtp.reply_to = noreply@example.com
6. If you do not have an SMTP server running locally on the machine that hosts
your CKAN instance, you can change the ``email-settings`` to send email via
an external SMTP server. For example, these settings in the ``[app:main]``
section of your configuration file will send emails using a gmail account
(not recommended for production websites!)::
smtp.server = smtp.gmail.com:587
smtp.starttls = True
smtp.user = your_username@gmail.com
smtp.password = your_gmail_password
smtp.mail_from = your_username@gmail.com
7. Initialize the subscribe tables in the database::
paster --plugin=ckanext-subscribe subscribe initdb
8. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu::
sudo service apache2 reload
9. You need to run the 'send-any-notifications' command regularly. You can see
it running on the command-line::
paster --plugin=ckanext-subscribe subscribe send-any-notifications -c /etc/ckan/default/production.ini
However instead you'll probably want a cron job setup to run it every minute
or so. We're going to edit the cron table. On a development machine, just do
this for your user::
crontab -e
Or a production machine use the 'ckan' user, instead of checking for notifications on the
command-line, create CRON job. To do so, edit the cron table with the
following command (it may ask you to choose an editor)::
sudo crontab -e -u ckan
Paste this line into your crontab, again replacing the paths to paster and the ini file with yours::
# m h dom mon dow command
* * * * * /usr/lib/ckan/default/bin/paster --plugin=ckanext-subscribe subscribe send-any-notifications --config=/etc/ckan/default/production.ini
This particular example will check for notifications every minute.
Also in this cron you will likely see it also running a paster command for
`/api/action/send_email_notifications`. This is similar but separate
functionality, that core CKAN uses to send emails to users that have created
user accounts e.g. for the 'follower' functionality. There's more about this
here: https://docs.ckan.org/en/2.8/maintaining/email-notifications.html
---------------
Config settings
---------------
::
# Email notifications older than this time period will not be sent.
# So, after a pause in the sending of emails, when it restarts, it will not
# notify about activity which is:
# * older than this period, for immediate subscriptions
# * older than this period + 1 day, for daily subscriptions
# * older than this period + 1 week, for weekly subscriptions
# Accepted formats: ‘2 days’, ‘14 days’, ‘4:35:00’ (hours, minutes, seconds),
# ‘7 days, 3:23:34’, etc.
# See also: https://docs.ckan.org/en/2.8/maintaining/configuration.html#ckan-email-notifications-since
# (optional, default: ‘2 days’)
ckan.email_notifications_since = 24:00:00
# The time that daily and weekly notification subscriptions are sent (UTC
# timezone)
ckanext.subscribe.daily_and_weekly_notification_time = 09:00
# The day of the week that weekly notification subscriptions are sent
ckanext.subscribe.weekly_notification_day = friday
---------------
Troubleshooting
---------------
**Notification emails not being sent**
1. Check your cron schedule is working::
tail -f /var/log/syslog | grep subscribe
You should see messages every minute::
Jan 10 15:24:01 ip-172-30-3-71 CRON[29231]: (ubuntu) CMD (/usr/lib/ckan/default/bin/paster --plugin=ckanext-subscribe subscribe run --config=/etc/ckan/default/production.ini)
2. Create a test activity for a dataset/group/org you are subscribed to::
paster --plugin=ckanext-subscribe subscribe create-test-activity mydataset --config=/etc/ckan/default/production.ini
The log of the cron-activated paster command itself is not currently stored anywhere, so it's best to test it on the commandline::
paster --plugin=ckanext-subscribe subscribe send-any-notifications --config=/etc/ckan/default/production.ini
You should see emails being sent to subscribers of that dataset::
2020-01-06 16:30:40,591 DEBUG [ckanext.subscribe.notification] send_any_immediate_notifications
2020-01-06 16:30:40,628 DEBUG [ckanext.subscribe.notification] sending 1 emails (immediate frequency)
2020-01-06 16:30:42,116 INFO [ckanext.subscribe.mailer] Sent email to david.read@hackneyworkshop.com
3. Clean up all test activity afterwards::
paster --plugin=ckanext-subscribe subscribe delete-test-activity --config=/etc/ckan/default/production.ini
**NameError: global name 'Subscription' is not defined**
You need to initialize the subscribe tables in the database. See
'Installation' section above to do this.
**KeyError: "Action 'subscribe_signup' not found"**
You need to enable the `subscribe` plugin in your CKAN config. See
'Installation' section above to do this.
**ProgrammingError: (ProgrammingError) relation "subscription" does not exist**
You're running the tests with `--reset-db` and this extension doesn't work with
that. Instead, if you need to wipe the tables before running tests, do it this
way::
sudo -u postgres psql ckan_test -c 'drop table if exists subscription; drop table if exists subscribe_login_code; drop table if exists subscribe;'
or simply::
sudo -u postgres dropdb ckan_test
sudo -u postgres createdb -O ckan_default ckan_test -E utf-8
paster --plugin=ckan db init -c ../ckan/test-core.ini
----------------------
Developer installation
----------------------
To install ckanext-subscribe for development, activate your CKAN virtualenv and
do::
git clone https://github.com/davidread/ckanext-subscribe.git
cd ckanext-subscribe
python setup.py develop
pip install -r dev-requirements.txt
Now continue Installation steps from step 3
-----
Tests
-----
To run the tests, do::
nosetests --nologcapture --with-pylons=test.ini
To run the tests and produce a coverage report, first make sure you have
coverage installed in your virtualenv (``pip install coverage``) then run::
nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.subscribe --cover-inclusive --cover-erase --cover-tests
--------------------------------------------
Releasing a new version of ckanext-subscribe
--------------------------------------------
ckanext-subscribe should be available on PyPI as https://pypi.org/project/ckanext-subscribe.
To publish a new version to PyPI follow these steps:
1. Update the version number in the ``setup.py`` file.
See `PEP 440 <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers>`_
for how to choose version numbers.
2. Update the CHANGELOG.md
3. Make sure you have the latest version of necessary packages::
pip install --upgrade setuptools wheel twine
4. Create a source and binary distributions of the new version::
python setup.py sdist bdist_wheel && twine check dist/*
Fix any errors you get.
5. Upload the source distribution to PyPI::
twine upload dist/*
6. Commit any outstanding changes::
git commit -a
git push
7. Tag the new release of the project on GitHub with the version number from
the ``setup.py`` file. For example if the version number in ``setup.py`` is
0.0.1 then do::
git tag 0.0.1
git push --tags
Raw data
{
"_id": null,
"home_page": "https://github.com/davidread/ckanext-subscribe",
"name": "ckanext-subscribe",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "CKAN email subscription notifications",
"author": "David Read",
"author_email": "david.read@hackneyworkshop.com",
"download_url": "https://files.pythonhosted.org/packages/df/c6/c81bf10b03b97584b68e72ebbfa473b1592cb9d95c480774bab245ac9265/ckanext-subscribe-1.1.0.tar.gz",
"platform": null,
"description": ".. You should enable this project on travis-ci.org and coveralls.io to make\n these badges work. The necessary Travis and Coverage config files have been\n generated for you.\n\n.. image:: https://travis-ci.org/davidread/ckanext-subscribe.svg?branch=master\n :target: https://travis-ci.org/davidread/ckanext-subscribe\n\n.. image:: https://coveralls.io/repos/github/davidread/ckanext-subscribe/badge.svg?branch=master\n :target: https://coveralls.io/github/davidread/ckanext-subscribe?branch=master\n\n.. image:: https://img.shields.io/pypi/v/ckanext-subscribe.svg\n :target: https://pypi.org/project/ckanext-subscribe/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/ckanext-subscribe.svg\n :target: https://pypi.org/project/ckanext-subscribe/\n :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/status/ckanext-subscribe.svg\n :target: https://pypi.org/project/ckanext-subscribe/\n :alt: Development Status\n\n.. image:: https://img.shields.io/pypi/l/ckanext-subscribe.svg\n :target: https://pypi.org/project/ckanext-subscribe/\n :alt: License\n\n=================\nckanext-subscribe\n=================\n\nCKAN extension that allows users to subscribe to dataset/organization/group\nupdates WITHOUT requiring them to login.\n\nThis feature is complementary to CKAN's existing \"Follow\" feature, which allows\nlogged in users to subscribe to get update emails. Log-in can be a barrier to\ncasual interest in say a handful of datasets. Generating and storing a password\nis a burden on the user, and for casual use just using temporary email links,\nas in this extension, is more appropriate.\n\n.. image:: doc/sign-up.png\n\nMore screenshots: https://github.com/davidread/ckanext-subscribe/tree/master/doc\n\n------------\nRequirements\n------------\n\nCompatibility with core CKAN versions:\n\n=============== =============\nCKAN version Compatibility\n=============== =============\n2.6 and earlier no\n2.7 yes\n2.8 yes\n2.9 not yet\n=============== =============\n\n------------\nInstallation\n------------\n\n.. Add any additional install steps to the list below.\n For example installing any non-Python dependencies or adding any required\n config settings.\n\nTo install ckanext-subscribe:\n\n1. Activate your CKAN virtual environment, for example::\n\n . /usr/lib/ckan/default/bin/activate\n\n2. Install the ckanext-subscribe Python package into your virtual environment::\n\n pip install ckanext-subscribe\n\n3. Add ``subscribe`` to the ``ckan.plugins`` setting in your CKAN\n configuration file (by default the config file is located at\n ``/etc/ckan/default/production.ini``).\n\n4. Make sure that ``ckan.site_url`` is set correctly in the ``[app:main]``\n section of your CKAN configuration file. This is used to generate links in\n the bodies of the notification emails. For example::\n\n ckan.site_url = https://example.com\n\n5. Make sure that ``smtp.mail_from`` is set correctly in the ``[app:main]``\n section of your CKAN configuration file. This is the email address that\n CKAN's email notifications will appear to come from. For example::\n\n smtp.mail_from = info@example.com\n\n This is combined with your ``ckan.site_title`` to form the ``From:`` header\n of the email that are sent, for example::\n\n From: Sunnyville Open Data <info@example.com>\n\n If you would like to use an alternate reply address, such as a \"no-reply\"\n address, set ``smtp.reply_to`` in the ``[app:main]``\n section of your CKAN configuration file. For example::\n\n smtp.reply_to = noreply@example.com\n\n6. If you do not have an SMTP server running locally on the machine that hosts\n your CKAN instance, you can change the ``email-settings`` to send email via\n an external SMTP server. For example, these settings in the ``[app:main]``\n section of your configuration file will send emails using a gmail account\n (not recommended for production websites!)::\n\n smtp.server = smtp.gmail.com:587\n smtp.starttls = True\n smtp.user = your_username@gmail.com\n smtp.password = your_gmail_password\n smtp.mail_from = your_username@gmail.com\n\n7. Initialize the subscribe tables in the database::\n\n paster --plugin=ckanext-subscribe subscribe initdb\n\n8. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu::\n\n sudo service apache2 reload\n\n9. You need to run the 'send-any-notifications' command regularly. You can see\n it running on the command-line::\n\n paster --plugin=ckanext-subscribe subscribe send-any-notifications -c /etc/ckan/default/production.ini\n\n However instead you'll probably want a cron job setup to run it every minute\n or so. We're going to edit the cron table. On a development machine, just do\n this for your user::\n\n crontab -e\n\n Or a production machine use the 'ckan' user, instead of checking for notifications on the\n command-line, create CRON job. To do so, edit the cron table with the\n following command (it may ask you to choose an editor)::\n\n sudo crontab -e -u ckan\n\n Paste this line into your crontab, again replacing the paths to paster and the ini file with yours::\n\n # m h dom mon dow command\n * * * * * /usr/lib/ckan/default/bin/paster --plugin=ckanext-subscribe subscribe send-any-notifications --config=/etc/ckan/default/production.ini\n\n This particular example will check for notifications every minute.\n\n Also in this cron you will likely see it also running a paster command for\n `/api/action/send_email_notifications`. This is similar but separate\n functionality, that core CKAN uses to send emails to users that have created\n user accounts e.g. for the 'follower' functionality. There's more about this\n here: https://docs.ckan.org/en/2.8/maintaining/email-notifications.html\n\n---------------\nConfig settings\n---------------\n\n::\n\n # Email notifications older than this time period will not be sent.\n # So, after a pause in the sending of emails, when it restarts, it will not\n # notify about activity which is:\n # * older than this period, for immediate subscriptions\n # * older than this period + 1 day, for daily subscriptions\n # * older than this period + 1 week, for weekly subscriptions\n # Accepted formats: \u20182 days\u2019, \u201814 days\u2019, \u20184:35:00\u2019 (hours, minutes, seconds),\n # \u20187 days, 3:23:34\u2019, etc.\n # See also: https://docs.ckan.org/en/2.8/maintaining/configuration.html#ckan-email-notifications-since\n # (optional, default: \u20182 days\u2019)\n ckan.email_notifications_since = 24:00:00\n\n # The time that daily and weekly notification subscriptions are sent (UTC\n # timezone)\n ckanext.subscribe.daily_and_weekly_notification_time = 09:00\n\n # The day of the week that weekly notification subscriptions are sent\n ckanext.subscribe.weekly_notification_day = friday\n\n\n---------------\nTroubleshooting\n---------------\n\n**Notification emails not being sent**\n\n1. Check your cron schedule is working::\n\n tail -f /var/log/syslog | grep subscribe\n\n You should see messages every minute::\n\n Jan 10 15:24:01 ip-172-30-3-71 CRON[29231]: (ubuntu) CMD (/usr/lib/ckan/default/bin/paster --plugin=ckanext-subscribe subscribe run --config=/etc/ckan/default/production.ini)\n\n2. Create a test activity for a dataset/group/org you are subscribed to::\n\n paster --plugin=ckanext-subscribe subscribe create-test-activity mydataset --config=/etc/ckan/default/production.ini\n\n The log of the cron-activated paster command itself is not currently stored anywhere, so it's best to test it on the commandline::\n\n paster --plugin=ckanext-subscribe subscribe send-any-notifications --config=/etc/ckan/default/production.ini\n\n You should see emails being sent to subscribers of that dataset::\n\n 2020-01-06 16:30:40,591 DEBUG [ckanext.subscribe.notification] send_any_immediate_notifications\n 2020-01-06 16:30:40,628 DEBUG [ckanext.subscribe.notification] sending 1 emails (immediate frequency)\n 2020-01-06 16:30:42,116 INFO [ckanext.subscribe.mailer] Sent email to david.read@hackneyworkshop.com\n\n3. Clean up all test activity afterwards::\n\n paster --plugin=ckanext-subscribe subscribe delete-test-activity --config=/etc/ckan/default/production.ini\n\n\n**NameError: global name 'Subscription' is not defined**\n\nYou need to initialize the subscribe tables in the database. See\n'Installation' section above to do this.\n\n\n**KeyError: \"Action 'subscribe_signup' not found\"**\n\nYou need to enable the `subscribe` plugin in your CKAN config. See\n'Installation' section above to do this.\n\n\n**ProgrammingError: (ProgrammingError) relation \"subscription\" does not exist**\n\nYou're running the tests with `--reset-db` and this extension doesn't work with\nthat. Instead, if you need to wipe the tables before running tests, do it this\nway::\n\n sudo -u postgres psql ckan_test -c 'drop table if exists subscription; drop table if exists subscribe_login_code; drop table if exists subscribe;'\n\nor simply::\n\n sudo -u postgres dropdb ckan_test\n sudo -u postgres createdb -O ckan_default ckan_test -E utf-8\n paster --plugin=ckan db init -c ../ckan/test-core.ini\n\n\n----------------------\nDeveloper installation\n----------------------\n\nTo install ckanext-subscribe for development, activate your CKAN virtualenv and\ndo::\n\n git clone https://github.com/davidread/ckanext-subscribe.git\n cd ckanext-subscribe\n python setup.py develop\n pip install -r dev-requirements.txt\n\nNow continue Installation steps from step 3\n\n\n-----\nTests\n-----\n\nTo run the tests, do::\n\n nosetests --nologcapture --with-pylons=test.ini\n\nTo run the tests and produce a coverage report, first make sure you have\ncoverage installed in your virtualenv (``pip install coverage``) then run::\n\n nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.subscribe --cover-inclusive --cover-erase --cover-tests\n\n\n--------------------------------------------\nReleasing a new version of ckanext-subscribe\n--------------------------------------------\n\nckanext-subscribe should be available on PyPI as https://pypi.org/project/ckanext-subscribe.\nTo publish a new version to PyPI follow these steps:\n\n1. Update the version number in the ``setup.py`` file.\n See `PEP 440 <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers>`_\n for how to choose version numbers.\n\n2. Update the CHANGELOG.md\n\n3. Make sure you have the latest version of necessary packages::\n\n pip install --upgrade setuptools wheel twine\n\n4. Create a source and binary distributions of the new version::\n\n python setup.py sdist bdist_wheel && twine check dist/*\n\n Fix any errors you get.\n\n5. Upload the source distribution to PyPI::\n\n twine upload dist/*\n\n6. Commit any outstanding changes::\n\n git commit -a\n git push\n\n7. Tag the new release of the project on GitHub with the version number from\n the ``setup.py`` file. For example if the version number in ``setup.py`` is\n 0.0.1 then do::\n\n git tag 0.0.1\n git push --tags\n\n\n",
"bugtrack_url": null,
"license": "AGPL",
"summary": "CKAN extension that allows users to subscribe to updates WITHOUT requiring loginn",
"version": "1.1.0",
"split_keywords": [
"ckan",
"email",
"subscription",
"notifications"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cbb6ab096615ec8cdad4349926070e05f2d9bcc8593e21dfef76cae3b05a1c62",
"md5": "0bcfc74788d5af130a8a7a44ef9d8ddf",
"sha256": "d7bd61b71c1f680c676a5b7ab85a470e6b98050f2ddafb0018809774a585dd64"
},
"downloads": -1,
"filename": "ckanext_subscribe-1.1.0-py2-none-any.whl",
"has_sig": false,
"md5_digest": "0bcfc74788d5af130a8a7a44ef9d8ddf",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 58830,
"upload_time": "2023-01-12T08:57:09",
"upload_time_iso_8601": "2023-01-12T08:57:09.349559Z",
"url": "https://files.pythonhosted.org/packages/cb/b6/ab096615ec8cdad4349926070e05f2d9bcc8593e21dfef76cae3b05a1c62/ckanext_subscribe-1.1.0-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dfc6c81bf10b03b97584b68e72ebbfa473b1592cb9d95c480774bab245ac9265",
"md5": "d6e31598751256427f8b028616349f4b",
"sha256": "517f6ea67775c7545ab984526ecd4c475a3ea73527d0a1a1bb9a6d12687c4f03"
},
"downloads": -1,
"filename": "ckanext-subscribe-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d6e31598751256427f8b028616349f4b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 47527,
"upload_time": "2023-01-12T08:57:13",
"upload_time_iso_8601": "2023-01-12T08:57:13.339478Z",
"url": "https://files.pythonhosted.org/packages/df/c6/c81bf10b03b97584b68e72ebbfa473b1592cb9d95c480774bab245ac9265/ckanext-subscribe-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-12 08:57:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "davidread",
"github_project": "ckanext-subscribe",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"requirements": [],
"lcname": "ckanext-subscribe"
}