transmogrify.dexterity


Nametransmogrify.dexterity JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/collective/transmogrify.dexterity
SummaryA transmogrifier blueprint for updating dexterity objects
upload_time2023-05-08 15:52:33
maintainer
docs_urlNone
author4teamwork AG
requires_python>=3.7
licenseGPL version 2
keywords python plone cms
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            
<h1 align="center">transmogrify.dexterity</h1>

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)
[![PyPI - License](https://img.shields.io/pypi/l/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)
[![PyPI - Status](https://img.shields.io/pypi/status/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)


[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)

[![Code analysis checks](https://github.com/collective/transmogrify.dexterity/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/collective/transmogrify.dexterity/actions/workflows/code-analysis.yml)
[![Tests](https://github.com/collective/transmogrify.dexterity/actions/workflows/tests.yml/badge.svg)](https://github.com/collective/transmogrify.dexterity/actions/workflows/tests.yml)
![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)

[![GitHub contributors](https://img.shields.io/github/contributors/collective/transmogrify.dexterity)](https://github.com/collective/transmogrify.dexterity)
[![GitHub Repo stars](https://img.shields.io/github/stars/collective/transmogrify.dexterity?style=social)](https://github.com/collective/transmogrify.dexterity)

</div>

## Introduction

The transmogrify.dexterity package provides a transmogrifier pipeline section
for updating field values of dexterity content objects. The blueprint name is
`transmogrify.dexterity.schemaupdater`.

The schemaupdater section needs at least the path to the object to update.
Paths to objects are always interpreted as being relative to the context. Any
writable field who's id matches a key in the current item will be updated with
the corresponding value.

Fields that do not get a value from the pipeline are initialized with their
default value or get a missing_value marker.
This functionality will be moved into a separate constructor pipeline...

The schmemaupdater section can also handle fields defined in behaviors.


## Actually tested and supported fields

- TextLine or Text

- Bool

- List

- NamedFileField: needs a dict with data and filename or get the filename in a seperated value from the pipeline

- Date:"needs a datetime.date or datetime.datetime object, or a string in the following format "%Y-%m-%d"

- Datetime: needs a datetime.datetime object, or a string parseable by    `DateTime.DateTime` e.g. "2015-12-31 17:59:59" or "2004/12/30 00:20:00 GMT+1" etc.


## Default pipelines

This package also registers a number of pipelines for you to use. To add them
to a GenericSetup profile, create a `transmogrifier.txt` with the name of the
pipeline you wish to use.


### transmogrify.dexterity.csvimport

This pipeline will convert a CSV file into dexterity content. To use it:

* Name your CSV `entries.csv`

* Create a file called `transmogrifier.txt` with the one line `transmogrify.dexterity.csvimport`

* Add both to a `.tar.gz` file

* Visit /Plone/portal_setup/manage_importSteps

* Select the tarball you just made

* "Import uploaded tarball"

...or add it as part of another GS profile.

The first row of the CSV is presumed to be column headings. Unless a special
column, the column will be presumed to be a dexterity property to update on the
type. Special column names are:-

- _type
    portal_type of content (optional, default is Document)

- _path
    Full path to content item, including content item.

- _folder
    Folder containing item, id will be derived from title

- _transitions
    Workflow transition (optional, default is "publish")

## Developing this package

Create the virtual enviroment and install all dependencies:

```shell
make build
```

Start Plone in foreground:

```shell
make start
```


### Running tests

```shell
make tests
```


### Formatting the codebase

```shell
make format
```

### Linting the codebase

```shell
make lint
```

## License

The project is licensed under the GPLv2.


## Contributors

- 4teamwork AG, info@4teamwork.ch
- Wesley Barroso, wesleybl@gmail.com
- Érico Andrei, ericof@plone.org


## Changelog

## 3.0.0 (2023-05-08)

- Doesn't try to convert byte to string. Python converts to string when json is loaded. @wesleybl

- Add Python 3.10 and 3.11 support @wesleybl

- Implement plone/code-analysis-action @ericof

- Add support to Plone 6.0 @ericof

- Drop support to Plone versions 4.3, 5.0 and 5.1 @ericof

- Drop support to Python 2.7 @ericof


### 2.0.0 (2021-09-28)

- Import relations fields that were exported as UID. @wesleybl

- Update plone.dublincore behavior fields, even if the object doesn't have this behavior. @wesleybl

- Add suport to Python 3.7 and 3.8 @wesleybl

- Add suport to Plone 4.3, 5.0, 5.1 and 5.2 @wesleybl


### 1.6.4 (2018-12-14)

- Fix date deserialization to work with any kind of separator or when it is None. @gbastien

- DatetimeDeserializer: check for the case when value is an empty string. @erral

### 1.6.3 (2016-10-11)

- Refactor DexterityUpdateSection: Factor out determining default value, getting value from pipeline and updating fields into their own methods. @lgraf


### 1.6.2 (2016-05-24)

- Fix blueprint context for support with ``transmogrifier`` package (not ``collective.transmogrifier``), which does not have dependencies to CMFPlone and thus doesn't provide a useful context. @thet


### 1.6.1 (2015-09-30)

- Do not import from deprecated zope.app.intid anymore, use zope.intid instead @jensens

- Fix deserializer if datetime is string "None". @elioschmutz


### 1.6.0 (2015-08-28)

- Implement new deserializer for datetime fields. @mbaechtold


### 1.5.2 (2015-07-13)

- Fix default container description to be unicode, not bytestring. See https://github.com/plone/plone.dexterity/pull/33 @jone


### 1.5.1 (2015-05-27)

- Make z3c.relationfield imports conditional. @jone


1.5 (2015-05-26)
----------------

- When retrieving the object via traversal from the path, check if it provides
  IDexterityContent. Traversal can also return attributes of objects, if no
  object can be found but the path element is named like an attribute. @thet

- Handle collective.jsonify structures, specifically _datafield_FIELDNAME and _content_type_FIELDNAME keys. @thet

- PEP8. @thet

- Add value converters for z3c.relationfield relation(-lists). @deiferni


1.4 (2014-11-06)
----------------

- Add blueprint for managing plone.app.multilingual translations @rnix


1.3 (2014-07-25)
----------------

- Use zope.dottedname.resolve to find class @lentinj

- Serialize/Deserialize zope.schema.IObjects @lentinj

- Add 'logger' and 'loglevel' options so invalid fields are logged when disable-constraints is True @ebrehault


1.2 (2013-08-29)
----------------

- Only update with a default value if there isn't a value already set
  on the field. (NB: before a default value would be set, regardless
  of the current field value). @lentinj


1.1 (2013-07-23)
----------------

- Don't try to write readonly fields @djowett

- Added in a generic CSV -> content pipeline @lentinj


1.0 (2011-11-17)
----------------

- Updated changelog to be zest releaser compatible @lgraf


### 1.0a5 (2011-07-18)

- Added check-constraints option to schemaupdater section.
  If set to False, field values that are set in the schemaupdater section won't
  be validated against the field's constraints. @lgraf

- Made CollectionDeserializer cast None and empty string to an empty list @lgraf

- Added a basic DateDeserializer @lgraf

- Using new-style classes for [de]serializers @lgraf


### 1.0a4 (2011-06-07)

- Ensure RichTextValue gets a decoded unicode string, add tests @lentinj

- Refactor to support more field types. @elro


### 1.0a3 (2010-03-12)

- Fixed bug in typechecking of values for Boolean fields @lgraf

- fixed dateconverting @phgross

- fixed value check: so that it works correctly with an empty string @phgross

- fixed handling for list and bool fields @phgross





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/collective/transmogrify.dexterity",
    "name": "transmogrify.dexterity",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Python Plone CMS",
    "author": "4teamwork AG",
    "author_email": "info@4teamwork.ch",
    "download_url": "https://files.pythonhosted.org/packages/03/3e/a449e9a1e8a20d685484fab8c79f04105e50289a08b2cadaadb44d24bf18/transmogrify.dexterity-3.0.0.tar.gz",
    "platform": null,
    "description": "\n<h1 align=\"center\">transmogrify.dexterity</h1>\n\n<div align=\"center\">\n\n[![PyPI](https://img.shields.io/pypi/v/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)\n[![PyPI - License](https://img.shields.io/pypi/l/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)\n[![PyPI - Status](https://img.shields.io/pypi/status/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)\n\n\n[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/transmogrify.dexterity)](https://pypi.org/project/transmogrify.dexterity/)\n\n[![Code analysis checks](https://github.com/collective/transmogrify.dexterity/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/collective/transmogrify.dexterity/actions/workflows/code-analysis.yml)\n[![Tests](https://github.com/collective/transmogrify.dexterity/actions/workflows/tests.yml/badge.svg)](https://github.com/collective/transmogrify.dexterity/actions/workflows/tests.yml)\n![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)\n\n[![GitHub contributors](https://img.shields.io/github/contributors/collective/transmogrify.dexterity)](https://github.com/collective/transmogrify.dexterity)\n[![GitHub Repo stars](https://img.shields.io/github/stars/collective/transmogrify.dexterity?style=social)](https://github.com/collective/transmogrify.dexterity)\n\n</div>\n\n## Introduction\n\nThe transmogrify.dexterity package provides a transmogrifier pipeline section\nfor updating field values of dexterity content objects. The blueprint name is\n`transmogrify.dexterity.schemaupdater`.\n\nThe schemaupdater section needs at least the path to the object to update.\nPaths to objects are always interpreted as being relative to the context. Any\nwritable field who's id matches a key in the current item will be updated with\nthe corresponding value.\n\nFields that do not get a value from the pipeline are initialized with their\ndefault value or get a missing_value marker.\nThis functionality will be moved into a separate constructor pipeline...\n\nThe schmemaupdater section can also handle fields defined in behaviors.\n\n\n## Actually tested and supported fields\n\n- TextLine or Text\n\n- Bool\n\n- List\n\n- NamedFileField: needs a dict with data and filename or get the filename in a seperated value from the pipeline\n\n- Date:\"needs a datetime.date or datetime.datetime object, or a string in the following format \"%Y-%m-%d\"\n\n- Datetime: needs a datetime.datetime object, or a string parseable by    `DateTime.DateTime` e.g. \"2015-12-31 17:59:59\" or \"2004/12/30 00:20:00 GMT+1\" etc.\n\n\n## Default pipelines\n\nThis package also registers a number of pipelines for you to use. To add them\nto a GenericSetup profile, create a `transmogrifier.txt` with the name of the\npipeline you wish to use.\n\n\n### transmogrify.dexterity.csvimport\n\nThis pipeline will convert a CSV file into dexterity content. To use it:\n\n* Name your CSV `entries.csv`\n\n* Create a file called `transmogrifier.txt` with the one line `transmogrify.dexterity.csvimport`\n\n* Add both to a `.tar.gz` file\n\n* Visit /Plone/portal_setup/manage_importSteps\n\n* Select the tarball you just made\n\n* \"Import uploaded tarball\"\n\n...or add it as part of another GS profile.\n\nThe first row of the CSV is presumed to be column headings. Unless a special\ncolumn, the column will be presumed to be a dexterity property to update on the\ntype. Special column names are:-\n\n- _type\n    portal_type of content (optional, default is Document)\n\n- _path\n    Full path to content item, including content item.\n\n- _folder\n    Folder containing item, id will be derived from title\n\n- _transitions\n    Workflow transition (optional, default is \"publish\")\n\n## Developing this package\n\nCreate the virtual enviroment and install all dependencies:\n\n```shell\nmake build\n```\n\nStart Plone in foreground:\n\n```shell\nmake start\n```\n\n\n### Running tests\n\n```shell\nmake tests\n```\n\n\n### Formatting the codebase\n\n```shell\nmake format\n```\n\n### Linting the codebase\n\n```shell\nmake lint\n```\n\n## License\n\nThe project is licensed under the GPLv2.\n\n\n## Contributors\n\n- 4teamwork AG, info@4teamwork.ch\n- Wesley Barroso, wesleybl@gmail.com\n- \u00c9rico Andrei, ericof@plone.org\n\n\n## Changelog\n\n## 3.0.0 (2023-05-08)\n\n- Doesn't try to convert byte to string. Python converts to string when json is loaded. @wesleybl\n\n- Add Python 3.10 and 3.11 support @wesleybl\n\n- Implement plone/code-analysis-action @ericof\n\n- Add support to Plone 6.0 @ericof\n\n- Drop support to Plone versions 4.3, 5.0 and 5.1 @ericof\n\n- Drop support to Python 2.7 @ericof\n\n\n### 2.0.0 (2021-09-28)\n\n- Import relations fields that were exported as UID. @wesleybl\n\n- Update plone.dublincore behavior fields, even if the object doesn't have this behavior. @wesleybl\n\n- Add suport to Python 3.7 and 3.8 @wesleybl\n\n- Add suport to Plone 4.3, 5.0, 5.1 and 5.2 @wesleybl\n\n\n### 1.6.4 (2018-12-14)\n\n- Fix date deserialization to work with any kind of separator or when it is None. @gbastien\n\n- DatetimeDeserializer: check for the case when value is an empty string. @erral\n\n### 1.6.3 (2016-10-11)\n\n- Refactor DexterityUpdateSection: Factor out determining default value, getting value from pipeline and updating fields into their own methods. @lgraf\n\n\n### 1.6.2 (2016-05-24)\n\n- Fix blueprint context for support with ``transmogrifier`` package (not ``collective.transmogrifier``), which does not have dependencies to CMFPlone and thus doesn't provide a useful context. @thet\n\n\n### 1.6.1 (2015-09-30)\n\n- Do not import from deprecated zope.app.intid anymore, use zope.intid instead @jensens\n\n- Fix deserializer if datetime is string \"None\". @elioschmutz\n\n\n### 1.6.0 (2015-08-28)\n\n- Implement new deserializer for datetime fields. @mbaechtold\n\n\n### 1.5.2 (2015-07-13)\n\n- Fix default container description to be unicode, not bytestring. See https://github.com/plone/plone.dexterity/pull/33 @jone\n\n\n### 1.5.1 (2015-05-27)\n\n- Make z3c.relationfield imports conditional. @jone\n\n\n1.5 (2015-05-26)\n----------------\n\n- When retrieving the object via traversal from the path, check if it provides\n  IDexterityContent. Traversal can also return attributes of objects, if no\n  object can be found but the path element is named like an attribute. @thet\n\n- Handle collective.jsonify structures, specifically _datafield_FIELDNAME and _content_type_FIELDNAME keys. @thet\n\n- PEP8. @thet\n\n- Add value converters for z3c.relationfield relation(-lists). @deiferni\n\n\n1.4 (2014-11-06)\n----------------\n\n- Add blueprint for managing plone.app.multilingual translations @rnix\n\n\n1.3 (2014-07-25)\n----------------\n\n- Use zope.dottedname.resolve to find class @lentinj\n\n- Serialize/Deserialize zope.schema.IObjects @lentinj\n\n- Add 'logger' and 'loglevel' options so invalid fields are logged when disable-constraints is True @ebrehault\n\n\n1.2 (2013-08-29)\n----------------\n\n- Only update with a default value if there isn't a value already set\n  on the field. (NB: before a default value would be set, regardless\n  of the current field value). @lentinj\n\n\n1.1 (2013-07-23)\n----------------\n\n- Don't try to write readonly fields @djowett\n\n- Added in a generic CSV -> content pipeline @lentinj\n\n\n1.0 (2011-11-17)\n----------------\n\n- Updated changelog to be zest releaser compatible @lgraf\n\n\n### 1.0a5 (2011-07-18)\n\n- Added check-constraints option to schemaupdater section.\n  If set to False, field values that are set in the schemaupdater section won't\n  be validated against the field's constraints. @lgraf\n\n- Made CollectionDeserializer cast None and empty string to an empty list @lgraf\n\n- Added a basic DateDeserializer @lgraf\n\n- Using new-style classes for [de]serializers @lgraf\n\n\n### 1.0a4 (2011-06-07)\n\n- Ensure RichTextValue gets a decoded unicode string, add tests @lentinj\n\n- Refactor to support more field types. @elro\n\n\n### 1.0a3 (2010-03-12)\n\n- Fixed bug in typechecking of values for Boolean fields @lgraf\n\n- fixed dateconverting @phgross\n\n- fixed value check: so that it works correctly with an empty string @phgross\n\n- fixed handling for list and bool fields @phgross\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "GPL version 2",
    "summary": "A transmogrifier blueprint for updating dexterity objects",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/collective/transmogrify.dexterity",
        "PyPI": "https://pypi.python.org/pypi/transmogrify.dexterity",
        "Source": "https://github.com/collective/transmogrify.dexterity",
        "Tracker": "https://github.com/collective/transmogrify.dexterity/issues"
    },
    "split_keywords": [
        "python",
        "plone",
        "cms"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "033ea449e9a1e8a20d685484fab8c79f04105e50289a08b2cadaadb44d24bf18",
                "md5": "54e6ce29d66e6eea9d2667ae31f534d2",
                "sha256": "d6f7c7836c68be7bdf3c7f89df1adb73bcb2ada970166469ecd50f59dbcf149c"
            },
            "downloads": -1,
            "filename": "transmogrify.dexterity-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "54e6ce29d66e6eea9d2667ae31f534d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 36151,
            "upload_time": "2023-05-08T15:52:33",
            "upload_time_iso_8601": "2023-05-08T15:52:33.636734Z",
            "url": "https://files.pythonhosted.org/packages/03/3e/a449e9a1e8a20d685484fab8c79f04105e50289a08b2cadaadb44d24bf18/transmogrify.dexterity-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-08 15:52:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "collective",
    "github_project": "transmogrify.dexterity",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "transmogrify.dexterity"
}
        
Elapsed time: 0.17351s