From 02a0a5be18d2b4c1d9804c48670e4f6eb5bd9702 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Thu, 3 May 2012 11:16:49 +0200 Subject: [PATCH] [#2345] Add autodocs to a couple of functions in action/create.py --- ckan/logic/action/create.py | 24 +++++++++++++++++++++++- doc/api-ref.rst | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ckan/logic/action/create.py b/ckan/logic/action/create.py index aee73a32aa4..355e6908200 100644 --- a/ckan/logic/action/create.py +++ b/ckan/logic/action/create.py @@ -421,7 +421,15 @@ def group_create_rest(context, data_dict): return group_dict def vocabulary_create(context, data_dict): + ''' + Create a new vocabulary and return a dictionary representation of it. + + :param name: The name for the new vocabulary, e.g. "Genre". + :type name: string + :returns: The newly-created vocabulary. + :rtype: dictionary. + ''' model = context['model'] schema = context.get('schema') or ckan.logic.schema.default_create_vocabulary_schema() @@ -489,8 +497,22 @@ def package_relationship_create_rest(context, data_dict): return relationship_dict def tag_create(context, tag_dict): - '''Create a new tag and return a dictionary representation of it.''' + ''' + Create a new vocabulary tag and return a dictionary representation of it. + You can only use this function to create tags that belong to a vocabulary, + not to create free tags. (To create a new free tag simply add the tag to + a package, e.g. using the package_update API method.) + + :param name: The name for the new tag, e.g. "Jazz". + :type name: string + :param vocabulary_id: The name or id of the vocabulary that the new tag + should be added to, e.g. "Genre". + :type vocabulary_id: string + :returns: The newly-created tag. + :rtype: dictionary. + + ''' model = context['model'] check_access('tag_create', context, tag_dict) diff --git a/doc/api-ref.rst b/doc/api-ref.rst index 4ecabf3583b..317aeb8f564 100644 --- a/doc/api-ref.rst +++ b/doc/api-ref.rst @@ -11,3 +11,6 @@ Also explain how the returns values of the functions end up in the json dict tha .. automodule:: ckan.logic.action.get :members: + +.. automodule:: ckan.logic.action.create + :members: