Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*_member_create don't raise validation errors #3108

Merged
merged 4 commits into from Jun 15, 2016

Conversation

Projects
None yet
2 participants
@amercader
Copy link
Member

commented Jun 13, 2016

organization_member_create and group_member_create don't raise validation errors if one of the parameters is missing (id, username or role, all mandatory).

This leads to confusing failures when submitting eg a key with an extra space ("username "):

(ProgrammingError) can't adapt type 'Missing' 'SELECT "user".password AS user_password, "user".id AS user_id, "user".name AS user_name, "user".openid AS user_openid, "user".fullname AS user_fullname, "user".email AS user_email, "user".apikey AS user_apikey, "user".created AS user_created, "user".reset_key AS user_reset_key, "user".about AS user_about, "user".activity_streams_email_notifications AS user_activity_streams_email_notifications, "user".sysadmin AS user_sysadmin, "user".state AS user_state \\nFROM "user" \\nWHERE "user".name = %(name_1)s ORDER BY "user".name \\n LIMIT %(param_1)s' {'name_1': <ckan.lib.navl.dictization_functions.Missing object at 0x7fb32056be10>, 'param_1': 1}

amercader added some commits Jun 13, 2016

[#3108] Raise validation errors on group/org_member_create
Add not_missing to the schema and raise the errors on the action. Adds
some tests as well
@@ -151,7 +151,6 @@ def setup_class(cls):

@classmethod
def teardown_class(cls):
p.unload('image_view')

This comment has been minimized.

Copy link
@wardi

wardi Jun 14, 2016

Contributor

is this related?

This comment has been minimized.

Copy link
@amercader

amercader Jun 15, 2016

Author Member

Not sure what happened here, I pushed a commit fixing it

'id': [group_id_exists, unicode],
'username': [user_name_exists, unicode],
'role': [role_exists, unicode],
'id': [not_missing, not_empty, group_id_or_name_exists, unicode],

This comment has been minimized.

Copy link
@wardi

wardi Jun 14, 2016

Contributor

not_empty is likely covered by group_id_or_name_exists (as below), but that's fine 😄

amercader added a commit that referenced this pull request Jun 15, 2016

@wardi wardi merged commit eb943c9 into master Jun 15, 2016

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

k-nut pushed a commit to k-nut/ckan that referenced this pull request Jul 4, 2016

[ckan#3108] Raise validation errors on group/org_member_create
Add not_missing to the schema and raise the errors on the action. Adds
some tests as well

k-nut pushed a commit to k-nut/ckan that referenced this pull request Jul 4, 2016

k-nut pushed a commit to k-nut/ckan that referenced this pull request Jul 4, 2016

k-nut pushed a commit to k-nut/ckan that referenced this pull request Jul 4, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

[#3108] Raise validation errors on group/org_member_create
Add not_missing to the schema and raise the errors on the action. Adds
some tests as well

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

[#3108] Raise validation errors on group/org_member_create
Add not_missing to the schema and raise the errors on the action. Adds
some tests as well

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

[#3108] Raise validation errors on group/org_member_create
Add not_missing to the schema and raise the errors on the action. Adds
some tests as well

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

amercader added a commit that referenced this pull request Aug 25, 2016

@smotornyuk smotornyuk deleted the 3108-validation-errors-on-member-create branch Dec 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.