Skip to content

Commit

Permalink
[#4914] Fix bad references
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Sep 6, 2019
1 parent 6138884 commit 8ca6e3b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ckan/config/middleware/__init__.py
Expand Up @@ -192,8 +192,8 @@ def __call__(self, environ, start_response):
if app_name == 'flask_app':
# This request will be served by Flask, but we still need the
# Pylons URL builder (Routes) to work
parts = urlparse(config.get('ckan.site_url',
'http://0.0.0.0:5000'))
parts = urlparse(
config.get('ckan.site_url', 'http://0.0.0.0:5000'))
request_config = routes_request_config()
request_config.host = str(parts.netloc + parts.path)
request_config.protocol = str(parts.scheme)
Expand Down
4 changes: 3 additions & 1 deletion ckan/lib/captcha.py
Expand Up @@ -13,7 +13,8 @@ def check_recaptcha(request):
# Recaptcha not enabled
return

client_ip_address = request.environ.get('REMOTE_ADDR', 'Unknown IP Address')
client_ip_address = request.environ.get(
'REMOTE_ADDR', 'Unknown IP Address')

# reCAPTCHA v2
recaptcha_response_field = request.form.get('g-recaptcha-response', '')
Expand All @@ -37,5 +38,6 @@ def check_recaptcha(request):
# Something weird with recaptcha response
raise CaptchaError()


class CaptchaError(ValueError):
pass
6 changes: 4 additions & 2 deletions ckan/lib/search/__init__.py
Expand Up @@ -315,8 +315,10 @@ def check_solr_schema_version(schema_file=None):

version = tree.documentElement.getAttribute('version')
if not len(version):
raise SearchError('Could not extract version info from the SOLR'
' schema, using file: \n%s' % url)
msg = 'Could not extract version info from the SOLR schema'
if schema_file:
msg =+ ', using file {}'.format(schema_file)
raise SearchError(msg)

if not version in SUPPORTED_SCHEMA_VERSIONS:
raise SearchError('SOLR schema version not supported: %s. Supported'
Expand Down
6 changes: 3 additions & 3 deletions ckanext/datapusher/logic/action.py
Expand Up @@ -65,7 +65,7 @@ def datapusher_submit(context, data_dict):

callback_url_base = config.get('ckan.datapusher.callback_url_base')
if callback_url_base:
callback_url = urlparse.urljoin(
callback_url = urljoin(
callback_url_base.rstrip('/'), '/api/3/action/datapusher_hook')
else:
callback_url = h.url_for(
Expand Down Expand Up @@ -123,7 +123,7 @@ def datapusher_submit(context, data_dict):

try:
r = requests.post(
urlparse.urljoin(datapusher_url, 'job'),
urljoin(datapusher_url, 'job'),
headers={
'Content-Type': 'application/json'
},
Expand Down Expand Up @@ -289,7 +289,7 @@ def datapusher_status(context, data_dict):
job_detail = None

if job_id:
url = urlparse.urljoin(datapusher_url, 'job' + '/' + job_id)
url = urljoin(datapusher_url, 'job' + '/' + job_id)
try:
r = requests.get(url, headers={'Content-Type': 'application/json',
'Authorization': job_key})
Expand Down

0 comments on commit 8ca6e3b

Please sign in to comment.