Skip to main content
=========================
collective.contentcreator
=========================

Create content structures from JSON files or Python dictionaries.

This package is meant as a helper to quickly create content structures from JSON files or Python structures for the purpose of pre-filling a site in development.
It's the successor of the package `collective.setuphandlertools <https://github.com/collective/collective.setuphandlertools>`_.


Examples
--------

Register a ``post_handler`` in a GenericSetup profile:

.. code-block:: xml

<genericsetup:registerProfile
name="basic_content"
title="create basic content structure"
directory="profiles/basic_content"
description="Creates the basic content structure"
provides="Products.GenericSetup.interfaces.EXTENSION"
post_handler=".setuphandlers.basic_content"
/>

In your ``setuphandler.py``:

.. code-block:: python

# -*- coding: utf-8 -*-
from collective.contentcreator import create_item_runner
from collective.contentcreator import load_json
from zope.component.hooks import getSite


def basic_content(context):
content_structure = load_json('data/basic_content.json', __file__)
create_item_runner(
getSite(),
content_structure,
default_lang='en',
default_wf_action='publish'
)

And in your ``data/basic_content.json``:

.. code-block:: json

[
{
"@type": "Folder",
"id": "main",
"title": "Main Folder",
"items": [
{"@type": "Page", "title": "Page within Folder"},
{"@type": "Folder", "title": "Folder within Folder", "description": "Not much more in here."}
]
}
]


License
-------

The project is licensed under the GPLv2.


Changelog
=========


2.0 (2018-12-03)
----------------

- Use ``plone.restapi`` and base content creator on ``plone.restapi.services.content.add``.
This gives us correct value deserialization and schema validation.
E.g. text fields are correctly deserialized to ``plone.app.textfield`` values.

Breaking Change: The JSON Structure is based on the ``plone.restapi`` JSON structure.
TBD
See: https://plonerestapi.readthedocs.io/en/latest/content.html#creating-a-resource-with-post
[thet]


1.0 (2018-12-01)
----------------

- Initial release.
[thet]

Metadata

Release files for collective.contentcreator 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.contentcreator 2.0
File Size Uploaded Provenance Actions
collective.contentcreator-2.0.tar.gz 11.6 kB Without provenance Details for collective.contentcreator-2.0.tar.gz

Release files / collective.contentcreator-2.0.tar.gz

Download URL collective.contentcreator-2.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ef8361ad326116767e00728cf1631052ebf8994d14dfb592f77cf32d13c4491f
BLAKE2b-256 checksum
How to use checksums
5b8b223bab25f8be860e8dd534cc7346e3059ed7289e82f3ef8131c3d356a6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

Security for collective.contentcreator 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page