Skip to content

Commit

Permalink
Merge 447995e into 8a796ab
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Oct 29, 2014
2 parents 8a796ab + 447995e commit e0c61ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ template snippets for editing and display are also supported.
Requirements
============

This plugin relies on the scheming-support branch
of ckan, see: https://github.com/ckan/ckan/pull/1795
This plugin relies on the latest master branch
of ckan (including at least commit e909360) or
the upcoming 2.3 release of ckan


Configuration
Expand Down
3 changes: 1 addition & 2 deletions bin/travis-install
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'

mkdir dl
cd dl
git clone https://github.com/wardi/ckan
git clone https://github.com/ckan/ckan
cd -
cd dl/ckan
git checkout 1795-scheming-support
python setup.py develop
# not interested in building CSS, just use production one
cp ./ckan/public/base/css/main.css ./ckan/public/base/css/main.debug.css
Expand Down
8 changes: 4 additions & 4 deletions ckanext/scheming/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def db_to_form_schema_options(self, options):
# FIXME: investigate why this is necessary
return default_show_group_schema()

def validate(self, context, data_dict, schema, action, group_type):
def validate(self, context, data_dict, schema, action):
thing, action_type = action.split('_')
t = group_type
t = data_dict.get('type')
if not t or t not in self._schemas: # pragma: no cover
return data_dict, {'type': "Unsupported {thing} type: {t}".format(
thing=thing, t=t)}
Expand Down Expand Up @@ -152,13 +152,13 @@ def resource_form(self):
def package_types(self):
return list(self._schemas)

def validate(self, context, data_dict, schema, action, dataset_type):
def validate(self, context, data_dict, schema, action):
"""
Validate and convert for package_create, package_update and
package_show actions.
"""
thing, action_type = action.split('_')
t = dataset_type
t = data_dict.get('type')
if not t or t not in self._schemas: # pragma: no cover
return data_dict, {'type': [
"Unsupported dataset type: {t}".format(t=t)]}
Expand Down
8 changes: 1 addition & 7 deletions ckanext/scheming/validation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ckan.plugins.toolkit import (get_validator, UnknownValidator,
get_converter, UnknownConverter)
from ckan.plugins.toolkit import get_validator, UnknownValidator

from ckanext.scheming.errors import SchemingException

Expand Down Expand Up @@ -35,9 +34,4 @@ def get_validator_or_converter(name):
return v
except UnknownValidator:
pass
try:
v = get_converter(name)
return v
except UnknownConverter:
pass
raise SchemingException('validator/converter not found: %r' % name)

0 comments on commit e0c61ea

Please sign in to comment.