Skip to main content

ckanext-ytp-comments

A custom CKAN extension for Data.Qld

Tests

CircleCI

Local environment setup

  • Make sure that you have latest versions of all required software installed:
  • Make sure that all local web development services are shut down (Apache/Nginx, Mysql, MAMP etc).
  • Checkout project repository (in one of the supported Docker directories).
  • pygmy up
  • ./build.sh
  • You may need to use sudo on linux

Building on Ubuntu (optional: behind proxy)

  • composer from compose
    • sudo pip install docker-compose
  • sudo apt-get install composer
  • ensure /etc/gemrc has the following http_proxy: http://localhost:3128 https_proxy: http://localhost:3128
  • if squid proxy is in use on your machine ensure that acl localnet src 172.17.0.0/16 # allows your public ip for loopback
  • https://docs.docker.com/network/proxy/ ~/.docker/config.json { "proxies": { "default": { "httpProxy": "http://hostexternalip:3128", "httpsProxy": "http://hostexternalip:3128", "noProxy": "" } } }
    • https://docs.docker.com/config/daemon/systemd/ sudo mkdir -p /etc/systemd/system/docker.service.d sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://localhost:3128/" sudo vi /etc/systemd/system/docker.service.d/https-proxy.conf [Service] Environment="HTTPS_PROXY=http://localhost:3128/" sudo systemctl daemon-reload sudo systemctl restart docker

Use admin/password to login to CKAN.

Available build commands

Run each command as ./build.sh <command>.

 build             Build or rebuild project.
 clean             Remove containers and all build files.
 cli               Start a shell inside CLI container or run a command.
 doctor            Find problems with current project setup.
 down              Stop Docker containers and remove container, images, volumes and networks.
 flush_redis       Flush Redis cache.
 info              Print information about this project.
 create_test_data  Add fake data suitable for scenario testing.
 lint              Lint code.
 logs              Show Docker logs.
 pull              Pull latest docker images.
 reset             Reset environment: remove containers, all build, manually created and Drupal-Dev files.
 restart           Restart all stopped and running Docker containers.
 start             Start existing Docker containers.
 stop              Stop running Docker containers.
 test_bdd          Create test data and run BDD tests.
 test_unit         Run unit tests.
 up                Build and start Docker containers.

Coding standards

Python code linting uses flake8 with configuration captured in .flake8 file.

Set ALLOW_LINT_FAIL=1 in .env to allow lint failures.

Unit tests

./build.sh test-unit

Set ALLOW_UNIT_FAIL=1 in .env to allow unit test failures.

Behavioral tests

./build.sh test-bdd

Set ALLOW_BDD_FAIL=1 in .env to allow BDD test failures.

How it works

We are using Behave BDD framework with additional step definitions provided by Behaving library.

Custom steps described in test/features/steps/steps.py.

Test scenarios located in test/features/*.feature files.

Test environment configuration is located in test/features/environment.py and is setup to connect to a remote Chrome instance running in a separate Docker container.

During the test, Behaving passes connection information to Splinter which instantiates WebDriver object and establishes connection with Chrome instance. All further communications with Chrome are handled through this driver, but in a developer-friendly way.

For a list of supported step-definitions, see https://github.com/ggozad/behaving#behavingweb-supported-matcherssteps.

Automated builds (Continuous Integration)

In software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day. Before feature changes can be merged into a shared mainline, a complete build must run and pass all tests on CI server.

This project uses GitHub Actions as a CI server: it imports production backups into fully built codebase and runs code linting and tests. When tests pass, a deployment process is triggered for nominated branches (usually, master and develop).

Follow / Mute comments

Comment notifications (via email) are managed by opt-in, i.e. without opting in to receive comment notifications at the content item or thread level, only authors or organisation admins will receive email notifications.

This feature allows users to following or mute comments at the content item level or for a specific comment thread on the content item.

When a user follows comments on a content item or content item thread they will receive email notifications when new comments or replies are posted.

Blacklist Words

Comments are checked using the profanityfilter Python module; any comments containing profanity are blocked.

'profanityfilter' has a built-in blacklist of words. Additional banned words are contained in ckanext/ytp/comments/bad_words.txt by default. You can point to another word list by setting ckan.comments.bad_words_file in your config.

Any words from the built-in list that you do not wish to block are contained in ckanext/ytp/comments/good_words.txt by default. You can point to another word list by setting ckan.comments.good_words_file in your config.

Installation

  1. Initialise the comment notification recipients database table, e.g.

     cd /usr/lib/ckan/default/src/ckanext-ytp-comments  # Your PATH may vary
     ckan -c /etc/ckan/default/development.ini initdb  # Use YOUR path and relevant CKAN .ini file
     ckan -c /etc/ckan/default/development.ini updatedb  # Use YOUR path and relevant CKAN .ini file
     ckan -c /etc/ckan/default/development.ini init_notifications_db  # Use YOUR path and relevant CKAN .ini file
    

    This will create a new table in the CKAN database named comment_notification_recipient that holds the status of individual user's follow or mute preferences.

    Note: if your deployment process does not run python setup.py develop after deploying code changes for extensions, you may need to run this in order for 'ckan' to recognise the init_notifications_db command:

     python setup.py develop
    
  2. Add the following config settings to your CKAN .ini file:

     ckan.comments.follow_mute_enabled = True
     # Optional
     ckan.comments.bad_words_file = /path/to/blacklist_words.txt
     ckan.comments.good_words_file = /path/to/whitelist_words.txt
     # To display dataset comments on a datasets tab page instead of below the dataset additional information, set to True
     ckan.comments.show_comments_tab_page = True # Defaults to False
    
  3. Restart CKAN

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckanext_ytp_comments-2.5.5.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ckanext_ytp_comments-2.5.5-py3-none-any.whl (67.5 kB view details)

Uploaded Python 3

File details

Details for the file ckanext_ytp_comments-2.5.5.tar.gz.

File metadata

  • Download URL: ckanext_ytp_comments-2.5.5.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ckanext_ytp_comments-2.5.5.tar.gz
Algorithm Hash digest
SHA256 4d8bb41b62043aa36620e18dc6bcbcc70409fe3f28add97e5524ba2660e7bf8a
MD5 7b08aadfee94c32baae193549c050649
BLAKE2b-256 28f4267d7f76be8a1d4609450164b76d8b69bad5c4acd3b09e1dd497d1ceadb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ckanext_ytp_comments-2.5.5.tar.gz:

Publisher: publish.yml on qld-gov-au/ckanext-ytp-comments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ckanext_ytp_comments-2.5.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_ytp_comments-2.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1b6955e92a49895fc5079ee1f9cdd2df2c96095089af065a161a980a9e16d6f8
MD5 e1a02fe6c60967fc51eeb63d67027506
BLAKE2b-256 2bc492276a25dcc8d13f917758062afa93bfeb8f96b01fde7162f0825f70e19b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ckanext_ytp_comments-2.5.5-py3-none-any.whl:

Publisher: publish.yml on qld-gov-au/ckanext-ytp-comments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.5.5 This release

2 files

2.5.3

2 files

2.5.2

2 files

2.5.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page