Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ee7a165
fix: Rewrite filter_activities using tk.get_action
kovalch Jul 3, 2025
a2f82f8
feat: Use the tool 2to3 to convert the codebase from python 2 to pyth…
kovalch Jul 3, 2025
acfb513
feat: Add WebHelpers to requirements
kovalch Jul 3, 2025
eea9296
feat: Write own string_to_timedelta helper function
kovalch Jul 3, 2025
91e1a6f
feat: Update import
bellisk Jul 3, 2025
cc94e2f
feat: Replace webhelpers (no longer used in CKAN)
bellisk Jul 3, 2025
a47d357
fix: Fix import statement
bellisk Jul 3, 2025
965853d
tests: Update path to test-core.ini
bellisk Jul 3, 2025
0ce11ac
fix: Remove WebHelpers, as it is no longer used in CKAN
bellisk Jul 3, 2025
d792178
fix: Remove unneeded helper function
bellisk Jul 3, 2025
3c739df
style: Run black and isort
bellisk Jul 3, 2025
2fac79d
style: Standardise importing toolkit
bellisk Jul 3, 2025
24e1f0c
style: Remove redundant parentheses
bellisk Jul 3, 2025
505116e
style: Convert string formatting to f-strings using flynt
bellisk Jul 3, 2025
a2fe7f1
style: Run black and fix some very long lines by hand
bellisk Jul 3, 2025
c15507a
fix: Remove IRouter, The IRoutes interface has been removed since it …
kovalch Jul 4, 2025
81f111e
fix: Remove the old fix reset_db errors
kovalch Jul 7, 2025
8dacc26
fix: Update init file
kovalch Jul 7, 2025
d723062
style: Fix missing lines in init file
bellisk Jul 8, 2025
837a6f6
fix: Remove unused 'perma' route from map
bellisk Jul 8, 2025
045aaca
feat: Start migrating from controllers to blueprints
bellisk Jul 8, 2025
e173a18
feat: Implement IBlueprint in plugin
bellisk Jul 8, 2025
c2c1151
feat: Update redirects to use new pattern
bellisk Jul 8, 2025
1575e0b
tests: Update tests to run on CKAN 2.10 and 2.11
bellisk Jul 8, 2025
df2046f
feat: Remove no-longer-used import
bellisk Jul 8, 2025
7123211
tests: Run tests as root for CKAN-2.11
bellisk Jul 8, 2025
684dcd7
tests: Run tests with pytest, not nose
bellisk Jul 8, 2025
79dbb6d
tests: Use unittest instead of node methods in tests
bellisk Jul 8, 2025
60e0fba
style: Remove unneeded encoding statement
bellisk Jul 8, 2025
6bd977c
tests: Require mock
bellisk Jul 8, 2025
1d533e5
tests: Get Activity model from ckanext-activity
bellisk Jul 8, 2025
40e9942
tests: Update factory classes
bellisk Jul 8, 2025
67958f3
feat: Migrate from Fanstatic to Webassets
kovalch Jul 8, 2025
6bb78f0
tests: Migrate database before running tests
bellisk Jul 8, 2025
7e79634
feat: Move css to public
kovalch Jul 8, 2025
a1a68a7
fix: Use webassets.yml
kovalch Jul 8, 2025
15e7d4f
Merge pull request #10 from opendata-swiss/migrate_to_webassets
kovalch Jul 8, 2025
23708a3
tests: Call with_plugins and clean_db fixtures together
bellisk Jul 8, 2025
3dc2b83
feat: Use shared metadata to define models
bellisk Jul 8, 2025
d4b5640
feat: Add alembic migration
bellisk Jul 8, 2025
a00690f
tests: Fix test command for github
bellisk Jul 8, 2025
aa20c50
feat: Add alembic migration files to manifest
bellisk Jul 8, 2025
084a732
feat: Specify version table in alembic env
bellisk Jul 8, 2025
98884e8
feat: Rename migration file
bellisk Jul 8, 2025
3b011aa
Merge pull request #11 from opendata-swiss/feat/switch-to-alembic
bellisk Jul 9, 2025
c4950c4
feat: Update getting request data and redirects in blueprints
bellisk Jul 9, 2025
780ae13
feat: Add allowed methods where needed
bellisk Jul 9, 2025
b64b05f
tests: Update tests
bellisk Jul 9, 2025
aa76838
feat: Update getting POST data
bellisk Jul 9, 2025
d0f984d
style: Remove unused imports
bellisk Jul 9, 2025
a82da87
feat: Update url_for and redirections for CKAN 2.11
bellisk Jul 9, 2025
f6c0552
fix: Restore url that uses - instead of _
bellisk Jul 9, 2025
6227ec1
feat: Use pytest fixture to set config value
bellisk Jul 9, 2025
315c76b
feat: Update url_for and redirections for CKAN 2.11
bellisk Jul 9, 2025
13ded1b
tests: Update tests for CKAN 2.11
bellisk Jul 9, 2025
fe35ee8
tests: Update tests for CKAN 2.1
bellisk Jul 9, 2025
bcc7e27
style: Remove unused imports
bellisk Jul 9, 2025
cfc5f38
style: Remove unneeded encoding lines
bellisk Jul 9, 2025
508b2fb
feat: Update home action to home.index
bellisk Jul 9, 2025
08d4b9f
tests: Update test
bellisk Jul 9, 2025
30cd5b9
tests: Update tests
bellisk Jul 9, 2025
7ff408f
Revert "fix: Rewrite filter_activities using tk.get_action"
bellisk Jul 9, 2025
4a1f8a0
feat: Get the activity model from ckanext-activity
bellisk Jul 9, 2025
3e19281
fix: Fix typo
bellisk Jul 9, 2025
886be03
tests: Apply activity plugin migrations before testing
bellisk Jul 9, 2025
670dce7
tests: Fix model used for queries in factories
bellisk Jul 9, 2025
d71864a
tests: Update tests for CKAN 2.11
bellisk Jul 9, 2025
55b4367
tests: Don't use == to compare types
bellisk Jul 9, 2025
c3e4910
tests: Update tests for CKAN 2.11
bellisk Jul 9, 2025
f71e2bb
tests: Update tests for CKAN 2.11
bellisk Jul 9, 2025
cdb2518
tests: Use model from ckanext-activity
bellisk Jul 9, 2025
928d2ec
tests: Update tests for CKAN 2.11
bellisk Jul 9, 2025
9512601
tests: Update tests for CKAN 2.11
bellisk Jul 9, 2025
f61097f
tests: Remove unneeded import
bellisk Jul 9, 2025
d6ec538
tests: Don't migrate db for activity plugin on CKAN 2.10
bellisk Jul 9, 2025
86c7c14
tests: Rename file
bellisk Jul 10, 2025
11e3de4
fix: Use names defined in webassets.yaml
kovalch Jul 10, 2025
b2e37e3
Merge branch 'master' into upgrade_to_py3_ckan2_11
kovalch Jul 11, 2025
a7ffc60
fix: Update type test
kovalch Jul 11, 2025
3c3b45b
fix: Update type test for all codes
kovalch Jul 11, 2025
ded7c6e
fix: Import ckan test helpers
kovalch Jul 11, 2025
1b33f10
style: Fix style issues
kovalch Jul 11, 2025
4b8c0aa
tests: Fix tests
bellisk Jul 22, 2025
1917b6a
Merge pull request #9 from opendata-swiss/upgrade_to_py3_ckan2_11
bellisk Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requirements
run: pip install flake8 pycodestyle black[python2]==21.12b0 click==8.0.4 isort
- name: Check syntax and complexity
run: |
flake8 . --count --select=C901,E901,E999,F401,F821,F822,F823 --show-source --statistics
run: pip install flake8 pycodestyle black isort
- name: Check syntax
run: flake8 . --count --select=C901,E721,E901,E999,F401,F821,F822,F823,F841 --show-source --statistics --extend-exclude ckan
- name: Check codestyle
run: |
isort --diff --check ckanext/
Expand All @@ -22,16 +19,17 @@ jobs:
needs: lint
strategy:
matrix:
ckan-version: [2.8, 2.7]
ckan-version: ["2.10", "2.11"]
fail-fast: false

name: CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
container:
image: openknowledge/ckan-dev:${{ matrix.ckan-version }}
image: ckan/ckan-dev:${{ matrix.ckan-version }}
options: --user root
services:
solr:
image: ckan/ckan-solr:${{ matrix.ckan-version }}
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
postgres:
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }}
env:
Expand Down Expand Up @@ -64,10 +62,11 @@ jobs:

- name: Setup extension
run: |
paster --plugin=ckan db init -c test.ini
ckan -c test.ini db init
ckan -c test.ini db pending-migrations --apply

- name: Run tests
run: nosetests --ckan --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.subscribe --cover-inclusive --cover-erase --cover-tests ckanext/subscribe
run: pytest --ckan-ini=test.ini --cov=ckanext.subscribe --cov-report=term-missing --cov-append --disable-warnings ckanext/subscribe/tests

- name: Coveralls
run: |
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ include README.rst
include LICENSE
include requirements.txt
recursive-include ckanext/subscribe *.html *.json *.js *.less *.css *.mo
recursive-include ckanext/subscribe/migration *.ini *.py *.mako
2 changes: 0 additions & 2 deletions ckanext/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

# this is a namespace package
try:
import pkg_resources
Expand Down
28 changes: 12 additions & 16 deletions ckanext/subscribe/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

import datetime
import logging

Expand Down Expand Up @@ -79,7 +77,7 @@ def subscribe_signup(context, data_dict):
raise tk.ValidationError("Invalid reCAPTCHA. Please try again.")
log.info("reCAPTCHA verification passed.")

_check_access(u"subscribe_signup", context, data_dict)
_check_access("subscribe_signup", context, data_dict)

data = {
"email": data_dict["email"],
Expand Down Expand Up @@ -130,7 +128,7 @@ def subscribe_signup(context, data_dict):
try:
email_verification.send_request_email(subscription)
except MailerException as exc:
log.error("Could not email manage code: {}".format(exc))
log.error(f"Could not email manage code: {exc}")
raise

subscription_dict = dictization.dictize_subscription(subscription, context)
Expand All @@ -150,7 +148,7 @@ def subscribe_verify(context, data_dict):
model = context["model"]
user = context["user"]

_check_access(u"subscribe_verify", context, data_dict)
_check_access("subscribe_verify", context, data_dict)

code = p.toolkit.get_or_bust(data_dict, "code")
subscription = (
Expand Down Expand Up @@ -194,7 +192,7 @@ def subscribe_update(context, data_dict):
"""
model = context["model"]

_check_access(u"subscribe_update", context, data_dict)
_check_access("subscribe_update", context, data_dict)

id_ = p.toolkit.get_or_bust(data_dict, "id")
subscription = model.Session.query(Subscription).get(id_)
Expand All @@ -218,7 +216,7 @@ def subscribe_list_subscriptions(context, data_dict):
"""
model = context["model"]

_check_access(u"subscribe_list_subscriptions", context, data_dict)
_check_access("subscribe_list_subscriptions", context, data_dict)
email = p.toolkit.get_or_bust(data_dict, "email")

subscription_objs = (
Expand All @@ -235,19 +233,17 @@ def subscribe_list_subscriptions(context, data_dict):
subscription["object_name"] = package.name
subscription["object_title"] = package.title
subscription["object_link"] = p.toolkit.url_for(
controller="package", action="read", id=package.name
"dataset.read", id=package.name
)
elif group and not group.is_organization:
subscription["object_name"] = group.name
subscription["object_title"] = group.title
subscription["object_link"] = p.toolkit.url_for(
controller="group", action="read", id=group.name
)
subscription["object_link"] = p.toolkit.url_for("group.read", id=group.name)
elif group and group.is_organization:
subscription["object_name"] = group.name
subscription["object_title"] = group.title
subscription["object_link"] = p.toolkit.url_for(
controller="organization", action="read", id=group.name
"organization.read", id=group.name
)
subscriptions.append(subscription)
return subscriptions
Expand All @@ -272,7 +268,7 @@ def subscribe_unsubscribe(context, data_dict):
"""
model = context["model"]

_check_access(u"subscribe_unsubscribe", context, data_dict)
_check_access("subscribe_unsubscribe", context, data_dict)

data = {"email": p.toolkit.get_or_bust(data_dict, "email"), "user": context["user"]}
if data_dict.get("dataset_id"):
Expand Down Expand Up @@ -315,7 +311,7 @@ def subscribe_unsubscribe_all(context, data_dict):
"""
model = context["model"]

_check_access(u"subscribe_unsubscribe_all", context, data_dict)
_check_access("subscribe_unsubscribe_all", context, data_dict)

data = {"email": p.toolkit.get_or_bust(data_dict, "email"), "user": context["user"]}

Expand All @@ -340,7 +336,7 @@ def subscribe_request_manage_code(context, data_dict):
"""
model = context["model"]

_check_access(u"subscribe_request_manage_code", context, data_dict)
_check_access("subscribe_request_manage_code", context, data_dict)

email = data_dict["email"]

Expand All @@ -356,7 +352,7 @@ def subscribe_request_manage_code(context, data_dict):
try:
email_auth.send_manage_email(manage_code, email=email)
except MailerException as exc:
log.error("Could not email manage code: {}".format(exc))
log.error(f"Could not email manage code: {exc}")
raise

return None
Expand Down
4 changes: 4 additions & 0 deletions ckanext/subscribe/assets/webassets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
subscribe/css/subscribe:
output: subscribe/css/subscribe.css
contents:
- css/subscribe.css
6 changes: 2 additions & 4 deletions ckanext/subscribe/auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

from ckan.plugins.toolkit import _, auth_allow_anonymous_access, check_access


Expand All @@ -19,15 +17,15 @@ def subscribe_signup(context, data_dict):
group = model.Group.get(group_id)
check_access("group_show", context, {"id": group.id})
else:
return {"success": False, "msg": _(u"No object specified")}
return {"success": False, "msg": _("No object specified")}

if (
skip_verification
and skip_verification not in (None, 0, False)
and skip_verification not in ("false", "f", "no", "n", "0")
):
# sysadmins only
return {"success": False, "msg": _(u"Not authorized to skip verification")}
return {"success": False, "msg": _("Not authorized to skip verification")}

return {"success": True}

Expand Down
Loading
Loading