Skip to content

Commit

Permalink
Return dataset id if 'return_pacakge_dict' is False
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader authored and tobes committed Aug 15, 2012
1 parent 8473cd8 commit 74f1257
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions ckan/logic/action/create.py
Expand Up @@ -99,7 +99,8 @@ def package_create(context, data_dict):
:type groups: list of dictionaries
:returns: the newly created dataset (if 'return_package_dict' is True in the
context, which is the default. Otherwise returns None)
context, which is the default. Otherwise returns just the dataset
id)
:rtype: dictionary
'''
Expand Down Expand Up @@ -166,7 +167,10 @@ def package_create(context, data_dict):

return_package_dict = context.get('return_package_dict',True)

return _get_action('package_show')(context, {'id':context['id']}) if return_package_dict else None
output = _get_action('package_show')(context, {'id':context['id']}) \
if return_package_dict else context['id']

return output

def package_create_validate(context, data_dict):
model = context['model']
Expand Down
8 changes: 6 additions & 2 deletions ckan/logic/action/update.py
Expand Up @@ -214,7 +214,8 @@ def package_update(context, data_dict):
:type id: string
:returns: the updated dataset (if 'return_package_dict' is True in the
context, which is the default. Otherwise returns None)
context, which is the default. Otherwise returns just the
dataset id)
:rtype: dictionary
'''
Expand Down Expand Up @@ -277,7 +278,10 @@ def package_update(context, data_dict):

return_package_dict = context.get('return_package_dict',True)

return _get_action('package_show')(context, data_dict) if return_package_dict else None
output = _get_action('package_show')(context, {'id': data_dict['id']}) \
if return_package_dict else data_dict['id']

return output

def package_update_validate(context, data_dict):
model = context['model']
Expand Down

0 comments on commit 74f1257

Please sign in to comment.