-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from DataShades/py3
Python3 support
- Loading branch information
Showing
28 changed files
with
1,941 additions
and
1,156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,44 @@ | ||
language: python | ||
|
||
# the new trusty images of Travis cause build errors with psycopg2, see https://github.com/travis-ci/travis-ci/issues/8897 | ||
dist: trusty | ||
group: deprecated-2017Q4 | ||
|
||
python: | ||
- "2.7" | ||
env: | ||
# - CKANVERSION=master | ||
- CKANVERSION=2.8 | ||
- CKANVERSION=2.7 | ||
os: linux | ||
language: python | ||
|
||
install: | ||
- bash bin/travis-build.bash | ||
services: | ||
- postgresql | ||
- redis | ||
addons: | ||
postgresql: "9.3" | ||
script: sh bin/travis-run.sh | ||
after_success: coveralls | ||
sudo: required | ||
- postgresql | ||
|
||
script: bash bin/travis-run.bash | ||
before_install: | ||
- pip install codecov | ||
after_success: | ||
- codecov | ||
|
||
jobs: | ||
include: | ||
- stage: Flake8 | ||
python: 2.7 | ||
env: FLAKE8=True | ||
install: | ||
- pip install flake8==3.5.0 | ||
- pip install pycodestyle==2.3.0 | ||
script: | ||
- flake8 --version | ||
# stop the build if there are Python syntax errors or undefined names | ||
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude ckan | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
# - flake8 . --count --max-line-length=127 --statistics --exclude ckan --exit-zero | ||
- stage: Tests | ||
python: "2.7" | ||
env: CKANVERSION=master | ||
- python: "3.6" | ||
env: CKANVERSION=master | ||
- python: "2.7" | ||
env: CKANVERSION=2.8 | ||
- python: "2.7" | ||
env: CKANVERSION=2.7 | ||
|
||
cache: | ||
directories: | ||
- $HOME/.cache/pip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,7 @@ | ||
import ckan.plugins as p | ||
|
||
_ = p.toolkit._ | ||
import ckanext.xloader.utils as utils | ||
|
||
|
||
class ResourceDataController(p.toolkit.BaseController): | ||
|
||
def resource_data(self, id, resource_id): | ||
|
||
if p.toolkit.request.method == 'POST': | ||
try: | ||
p.toolkit.c.pkg_dict = \ | ||
p.toolkit.get_action('xloader_submit')( | ||
None, {'resource_id': resource_id} | ||
) | ||
except p.toolkit.ValidationError: | ||
pass | ||
|
||
p.toolkit.redirect_to( | ||
controller='ckanext.xloader.controllers:ResourceDataController', | ||
action='resource_data', | ||
id=id, | ||
resource_id=resource_id | ||
) | ||
|
||
try: | ||
p.toolkit.c.pkg_dict = p.toolkit.get_action('package_show')( | ||
None, {'id': id} | ||
) | ||
p.toolkit.c.resource = p.toolkit.get_action('resource_show')( | ||
None, {'id': resource_id} | ||
) | ||
except (p.toolkit.ObjectNotFound, p.toolkit.NotAuthorized): | ||
p.toolkit.abort(404, _('Resource not found')) | ||
|
||
try: | ||
xloader_status = p.toolkit.get_action('xloader_status')( | ||
None, {'resource_id': resource_id} | ||
) | ||
except p.toolkit.ObjectNotFound: | ||
xloader_status = {} | ||
except p.toolkit.NotAuthorized: | ||
p.toolkit.abort(403, _('Not authorized to see this page')) | ||
|
||
return p.toolkit.render('xloader/resource_data.html', | ||
extra_vars={ | ||
'status': xloader_status, | ||
'resource': p.toolkit.c.resource, | ||
'pkg_dict': p.toolkit.c.pkg_dict, | ||
}) | ||
return utils.resource_data(id, resource_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.