[ckan-changes] [okfn/ckan] 31cb37: [xs][create_test_data] allow create_arbitrary to t...

GitHub noreply at github.com
Wed Apr 25 10:44:12 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: 31cb37d5aeafbce2677ea8915ebf33505ca900b5
      https://github.com/okfn/ckan/commit/31cb37d5aeafbce2677ea8915ebf33505ca900b5
  Author: John Glover <j at johnglover.net>
  Date:   2012-04-25 (Wed, 25 Apr 2012)

  Changed paths:
    M ckan/lib/create_test_data.py

  Log Message:
  -----------
  [xs][create_test_data] allow create_arbitrary to take an optional list of core field names so it can be used from extensions with custom schemas


diff --git a/ckan/lib/create_test_data.py b/ckan/lib/create_test_data.py
index 44d5c64..6f73e55 100644
--- a/ckan/lib/create_test_data.py
+++ b/ckan/lib/create_test_data.py
@@ -173,8 +173,8 @@ def create_vocabs_test_data(cls):
 
     @classmethod
     def create_arbitrary(cls, package_dicts, relationships=[],
-            extra_user_names=[], extra_group_names=[],
-            admins=[]):
+                         extra_user_names=[], extra_group_names=[],
+                         admins=[], extra_core_fields=[]):
         '''Creates packages and a few extra objects as well at the
         same time if required.
         @param package_dicts - a list of dictionaries with the package
@@ -196,6 +196,8 @@ def create_arbitrary(cls, package_dicts, relationships=[],
         new_group_names = set()
         new_groups = {}
 
+        cls.pkg_core_fields.extend(extra_core_fields)
+
         rev = model.repo.new_revision()
         rev.author = cls.author
         rev.message = u'Creating test packages.'


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



More information about the ckan-changes mailing list