[ckan-changes] [okfn/ckan] 02a0a5: [#2345] Add autodocs to a couple of functions in a...

GitHub noreply at github.com
Thu May 3 09:17:36 UTC 2012


  Branch: refs/heads/feature-2345-action-api-autodocs
  Home:   https://github.com/okfn/ckan
  Commit: 02a0a5be18d2b4c1d9804c48670e4f6eb5bd9702
      https://github.com/okfn/ckan/commit/02a0a5be18d2b4c1d9804c48670e4f6eb5bd9702
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M ckan/logic/action/create.py
    M doc/api-ref.rst

  Log Message:
  -----------
  [#2345] Add autodocs to a couple of functions in action/create.py


diff --git a/ckan/logic/action/create.py b/ckan/logic/action/create.py
index aee73a3..355e690 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 4ecabf3..317aeb8 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:


================================================================



More information about the ckan-changes mailing list