Skip to content

Commit

Permalink
[#1178] Move user_invite_schema to ckan.logic.schema
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorbaptista committed Oct 11, 2013
1 parent d073ce7 commit 1da817c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ckan/logic/action/create.py
Expand Up @@ -860,12 +860,8 @@ def user_invite(context, data_dict):
'''
_check_access('user_invite', context, data_dict)

user_invite_schema = {
'email': [validators.not_empty, unicode],
'group_id': [validators.not_empty],
'role': [validators.not_empty],
}
data, errors = _validate(data_dict, user_invite_schema, context)
schema = context.get('schema') or ckan.logic.schema.default_user_invite_schema()
data, errors = _validate(data_dict, schema, context)
if errors:
raise ValidationError(errors)

Expand Down
8 changes: 8 additions & 0 deletions ckan/logic/schema.py
Expand Up @@ -424,6 +424,14 @@ def default_update_user_schema():

return schema

def default_user_invite_schema():
schema = {
'email': [not_empty, unicode],
'group_id': [not_empty],
'role': [not_empty],
}
return schema

def default_task_status_schema():
schema = {
'id': [ignore],
Expand Down

0 comments on commit 1da817c

Please sign in to comment.