Skip to content

Commit

Permalink
Drop pylons support
Browse files Browse the repository at this point in the history
  • Loading branch information
seitenbau-govdata committed Apr 27, 2023
1 parent c664567 commit 482bb1b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 99 deletions.
33 changes: 24 additions & 9 deletions ckanext/dcat/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
from ckantoolkit import config

from ckan import plugins as p
try:
from ckan.lib.plugins import DefaultTranslation
except ImportError:
class DefaultTranslation(object):
pass

from ckan.lib.plugins import DefaultTranslation

import ckanext.dcat.blueprints as blueprints
import ckanext.dcat.cli as cli

from ckanext.dcat.logic import (dcat_dataset_show,
dcat_catalog_show,
Expand All @@ -21,8 +20,6 @@ class DefaultTranslation(object):
)
from ckanext.dcat import utils

from ckanext.dcat.plugins.flask_plugin import MixinDCATPlugin, MixinDCATJSONInterface


CUSTOM_ENDPOINT_CONFIG = 'ckanext.dcat.catalog_endpoint'
TRANSLATE_KEYS_CONFIG = 'ckanext.dcat.translate_keys'
Expand All @@ -31,14 +28,26 @@ class DefaultTranslation(object):
I18N_DIR = os.path.join(HERE, u"../i18n")


class DCATPlugin(MixinDCATPlugin, p.SingletonPlugin, DefaultTranslation):
class DCATPlugin(p.SingletonPlugin, DefaultTranslation):

p.implements(p.IConfigurer, inherit=True)
p.implements(p.ITemplateHelpers, inherit=True)
p.implements(p.IActions, inherit=True)
p.implements(p.IAuthFunctions, inherit=True)
p.implements(p.IPackageController, inherit=True)
p.implements(p.ITranslation, inherit=True)
p.implements(p.IClick)
p.implements(p.IBlueprint)

# IClick

def get_commands(self):
return cli.get_commands()

# IBlueprint

def get_blueprint(self):
return [blueprints.dcat]

# ITranslation

Expand Down Expand Up @@ -123,9 +132,15 @@ def set_titles(object_dict):
return data_dict


class DCATJSONInterface(MixinDCATJSONInterface, p.SingletonPlugin):
class DCATJSONInterface(p.SingletonPlugin):
p.implements(p.IActions)
p.implements(p.IAuthFunctions, inherit=True)
p.implements(p.IBlueprint)

# IBlueprint

def get_blueprint(self):
return [blueprints.dcat_json_interface]

# IActions

Expand Down
30 changes: 0 additions & 30 deletions ckanext/dcat/plugins/flask_plugin.py

This file was deleted.

52 changes: 0 additions & 52 deletions ckanext/dcat/plugins/pylons_plugin.py

This file was deleted.

8 changes: 0 additions & 8 deletions ckanext/dcat/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,6 @@ def _get_from_extra(key):

config.update({DCAT_EXPOSE_SUBCATALOGS: args.subcatalogs})

# Workaround until the core translation function defaults to the Flask one
from paste.registry import Registry
from ckan.lib.cli import MockTranslator
registry = Registry()
registry.prepare()
from pylons import translator
registry.register(translator, MockTranslator())

if args.mode == 'produce':
serializer = RDFSerializer(profiles=args.profile,
compatibility_mode=args.compat_mode)
Expand Down

0 comments on commit 482bb1b

Please sign in to comment.