Skip to main content

Adds commenting on datasets and data requests

Project description

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
  • ahoy build
  • 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 ahoy commands

Run each command as ahoy <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.
 install-site Install a site.
 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     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.

Nose tests

ahoy test-unit

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

Behavioral tests

ahoy 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

Project details


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.3.tar.gz (52.1 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.3-py3-none-any.whl (67.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ckanext_ytp_comments-2.5.3.tar.gz
  • Upload date:
  • Size: 52.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ckanext_ytp_comments-2.5.3.tar.gz
Algorithm Hash digest
SHA256 5270ae0b3cd59da1586e1caa458d3bc8fe45053696f9594c4f6afc5c32383e81
MD5 32c32328bc7fbdad785ea37edf91ce26
BLAKE2b-256 d8aced2484f753302450e21bcef9b2a053ab6377ad6f7eb38246b3a95e8c43e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ckanext_ytp_comments-2.5.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_ytp_comments-2.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 60989ba24f53d2bf6e7139dee9851b34398c81b5c669b4b6fe0445a363430ec9
MD5 e94c4460cee04e5f0dd0a78d821c4df6
BLAKE2b-256 a432a414c9df65c4f988b5757c8b0912d004cbdbfbad180b47c3308690203747

See more details on using hashes here.

Provenance

The following attestation bundles were made for ckanext_ytp_comments-2.5.3-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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page