[#49] Use of builtins module in controller breaks CKAN Version: >= 2.7, <=2.9 compatibility

Added version check to controller to control builtins import
This commit is contained in:
Scott Limmer 2020-11-13 11:12:34 +11:00
parent 3e620b574a
commit 27969ba3cc
1 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,5 @@
from __future__ import absolute_import
from builtins import str
import logging
from ckan.lib.base import BaseController, c, render, request
from . import dbutil
@ -13,6 +13,16 @@ from paste.util.multidict import MultiDict
from ckan.controllers.api import ApiController
from ckan.exceptions import CkanVersionException
import ckan.plugins.toolkit as tk
try:
tk.requires_ckan_version("2.9")
except CkanVersionException:
pass
else:
from builtins import str
log = logging.getLogger("ckanext.googleanalytics")