Skip to content

Commit

Permalink
Merge pull request #164 from pdelboca/add-csrf-and-drop-support-old-v…
Browse files Browse the repository at this point in the history
…ersions

Add CSRF token and drop support old versions
  • Loading branch information
pdelboca authored Feb 16, 2023
2 parents 51e35c5 + 72141f2 commit a9c86ce
Show file tree
Hide file tree
Showing 51 changed files with 11,217 additions and 11,063 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.6'
python-version: '3.10'
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Check syntax
Expand All @@ -17,7 +17,7 @@ jobs:
needs: lint
strategy:
matrix:
ckan-version: ["2.10", 2.9, 2.9-py2, 2.8, 2.7]
ckan-version: ["2.10", 2.9]
fail-fast: false

name: CKAN ${{ matrix.ckan-version }}
Expand All @@ -44,7 +44,7 @@ jobs:
CKAN_REDIS_URL: redis://redis:6379/1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install requirements
run: |
pip install -r requirements.txt
Expand All @@ -53,16 +53,10 @@ jobs:
# Replace default path to CKAN core config file with the one on the container
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini
- name: Setup extension (CKAN >= 2.9)
if: ${{ matrix.ckan-version != '2.7' && matrix.ckan-version != '2.8' }}
run: |
ckan -c test.ini db init
- name: Setup extension (CKAN < 2.9)
if: ${{ matrix.ckan-version == '2.7' || matrix.ckan-version == '2.8' }}
run: |
paster --plugin=ckan db init -c test.ini
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.showcase --cov-report=xml --cov-append --disable-warnings ckanext/showcase/tests

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v1
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ __pycache__/
# Distribution / packaging
.Python
env/
build/
develop-eggs/
sdist/
*.egg-info/
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Ckanext-showcase CHANGELOG

## v1.6.0 2023-02-14

* Dropped support for CKAN 2.7 and 2.8
* Dropped support for Python 2
* Add support for CSRF token
* Sanitize blueprint names. All views should be called using `showcase_blueprint.<endpoint>`
* Rename get_showcase_wysiwyg_editor to avoid name clashes with other extensions (like `ckanext-pages`)
* Update CKEditor to it's latest version: 36.0.1

## v1.5.1 2022-08-10

* Dependency update
Expand Down
24 changes: 12 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ ckanext-showcase is intended to be a more powerful replacement for the
Requirements
------------

Tested on CKAN 2.7 to 2.10..
Tested on CKAN 2.9 and 2.10.

Note: Use `1.5.2` for older CKAN versions (2.7 and 2.8).

------------
Installation
Expand Down Expand Up @@ -68,7 +70,7 @@ do::

git clone https://github.com/ckan/ckanext-showcase.git
cd ckanext-showcase
python setup.py develop
pip install -e .
pip install -r dev-requirements.txt


Expand All @@ -79,11 +81,14 @@ repository contains all the files needed to edit and customize it if needed::
npm install
npx webpack --config webpack.config.js

The webpack will use as entrypoint a file located in `ckanext/showcase/fanstatic/src/ckeditor.js`,
create a build and save it to `ckanext/showcase/fanstatic/dist/ckeditor.js`
Build anatomy
* assets/build/ckeditor.js - The ready-to-use editor bundle, containing the editor and all plugins.
* assets/js/showcase-editor - The CKAN module that will load and config the bundle when using it as data-module attribute.
* assets/src/ckeditor.js - The source entry point of the build. Based on it the build/ckeditor.js file is created by webpack. It defines the editor creator, the list of plugins and the default configuration of a build.
* webpack.config.js - The webpack configuration used to build the editor.

More info on how to build CKEditor from source:
https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/advanced-setup.html#scenario-2-building-from-source
https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/quick-start-other.html#building-the-editor-from-source


---
Expand Down Expand Up @@ -168,20 +173,15 @@ HTML you can use the ```showcase markdown_to_html``` command.

From the ``ckanext-showcase`` directory::

paster showcase markdown-to-html -c {path to production.ini}
ckan -c {path to production.ini} showcase markdown-to-html

-----------------
Running the Tests
-----------------

To run the tests, do::

nosetests --ckan --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 --ckan --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.showcase --cover-inclusive --cover-erase --cover-tests
pytest --ckan-ini=test.ini ckanext/showcase/tests


------------------------------------
Expand Down
Loading

0 comments on commit a9c86ce

Please sign in to comment.