Add support for the new ITranslation interface
Move the i18n files to the expected place, load the interface if CKAN >= 2.5.0
This commit is contained in:
parent
121e8bd918
commit
84fb3e3325
|
@ -7,6 +7,12 @@ from ckan import logic
|
||||||
from ckan import model
|
from ckan import model
|
||||||
import ckan.plugins as p
|
import ckan.plugins as p
|
||||||
from ckan.lib.plugins import DefaultDatasetForm
|
from ckan.lib.plugins import DefaultDatasetForm
|
||||||
|
try:
|
||||||
|
from ckan.lib.plugins import DefaultTranslation
|
||||||
|
except ImportError:
|
||||||
|
class DefaultTranslation():
|
||||||
|
pass
|
||||||
|
|
||||||
from ckan.lib.navl import dictization_functions
|
from ckan.lib.navl import dictization_functions
|
||||||
|
|
||||||
from ckanext.harvest import logic as harvest_logic
|
from ckanext.harvest import logic as harvest_logic
|
||||||
|
@ -15,12 +21,14 @@ from ckanext.harvest.model import setup as model_setup
|
||||||
from ckanext.harvest.model import HarvestSource, HarvestJob, HarvestObject
|
from ckanext.harvest.model import HarvestSource, HarvestJob, HarvestObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
assert not log.disabled
|
assert not log.disabled
|
||||||
|
|
||||||
DATASET_TYPE_NAME = 'harvest'
|
DATASET_TYPE_NAME = 'harvest'
|
||||||
|
|
||||||
class Harvest(p.SingletonPlugin, DefaultDatasetForm):
|
|
||||||
|
class Harvest(p.SingletonPlugin, DefaultDatasetForm, DefaultTranslation):
|
||||||
|
|
||||||
p.implements(p.IConfigurable)
|
p.implements(p.IConfigurable)
|
||||||
p.implements(p.IRoutes, inherit=True)
|
p.implements(p.IRoutes, inherit=True)
|
||||||
|
@ -31,6 +39,9 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm):
|
||||||
p.implements(p.IPackageController, inherit=True)
|
p.implements(p.IPackageController, inherit=True)
|
||||||
p.implements(p.ITemplateHelpers)
|
p.implements(p.ITemplateHelpers)
|
||||||
p.implements(p.IFacets, inherit=True)
|
p.implements(p.IFacets, inherit=True)
|
||||||
|
if p.toolkit.check_ckan_version(min_version='2.5.0'):
|
||||||
|
p.implements(p.ITranslation, inherit=True)
|
||||||
|
|
||||||
|
|
||||||
startup = False
|
startup = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue