Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Plone 4 / Python 2 compatibility #233

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
1.11 (unreleased)
-----------------

- Add more Python 2 compatible version specifications and update the README.
[thet]

- Fix ``KeyError: time`` when importing content with a workflow that does not have the ``time`` variable.
[maurits]

Expand Down
100 changes: 30 additions & 70 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@ Import supports:

* Plone 5.2+, Dexterity, Python 2 and 3, plone.app.multilingual


Installation
============

Install collective.exportimport as you would install any other Python package.

You don't need to activate the add-on in the Site Setup Add-ons control panel to be able to use the forms ``@@export_content`` and ``@@import_content`` in your site.

If you need help, see:
- for Plone 4: https://4.docs.plone.org/adapt-and-extend/install_add_ons.html
- for Plone 5: https://5.docs.plone.org/manage/installing/installing_addons.html
- for Plone 6: https://6.docs.plone.org/install/manage-add-ons-packages.html


Python 2 compatibility
----------------------

This package is compatible with Python 3 and Python 2.
Depending on the Python version different versions of it's dependencies will be installed.
If you run into problems, file an issue at: https://github.com/collective/collective.exportimport/issues


Usage
=====

Expand Down Expand Up @@ -2146,14 +2168,6 @@ This ``global_obj_hook`` below stores that data in a annotation:
annotations[DEFERRED_KEY] = data


Written by
==========

.. image:: ./docs/starzel.png
:target: https://www.starzel.de
:alt: Starzel.de


Translations
============

Expand All @@ -2162,68 +2176,6 @@ This product has been translated into
- Spanish


Installation
============

Install collective.exportimport by adding it to your buildout::

[buildout]

...

eggs =
collective.exportimport


and then running ``bin/buildout``

You don't need to activate the add-on in the Site Setup Add-ons control panel to be able to use the forms ``@@export_content`` and ``@@import_content`` in your site.

You do need to add it to your buildout configuration and run buildout to make these features available at all. See https://docs.plone.org/manage/installing/installing_addons.html for details.

Installing in Plone 4
---------------------

``collective.exportimport`` depends on ``plone.restapi``. For Plone 4, you need to pin ``plone.restapi`` to 7.x . When installing ``plone.restapi`` version 7.x.x in Plone 4 you may need to add the following version pins to your buildout::

[versions]
PyJWT = 1.7.1

six = 1.11.0
attrs = 21.2.0
plone.rest = 1.6.2
plone.schema = 1.3.0
# Last pyrsistent version that is python 2 compatible:
pyrsistent = 0.15.7

# Required by:
# jsonschema==3.2.0
functools32 = 3.2.3.post2

# Required by:
# plone.schema==1.3.0
jsonschema = 3.2.0

# Required by:
# importlib-metadata==1.3.0
pathlib2 = 2.3.5

# Required by:
# pathlib2==2.3.5
scandir = 1.10.0

# plone.app.contenttypes > 1.0
plone.app.contenttypes = 1.1.9

importlib-metadata = 2.1.3
zipp = 1.2.0
configparser = 4.0.2
contextlib2 = 0.6.0.post1


These versions are taken from the ``plone.restapi`` 7.x README: https://pypi.org/project/plone.restapi/7.8.1/


Contribute
==========

Expand All @@ -2241,3 +2193,11 @@ License
-------

The project is licensed under the GPLv2.


Written by
==========

.. image:: ./docs/starzel.png
:target: https://www.starzel.de
:alt: Starzel.de
19 changes: 12 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,31 @@
)

install_requires = [
"setuptools",
"plone.api >= 1.8.4",
"hurry.filesize",
"ijson",
"setuptools",
"six",
]

if sys.version_info[0] < 3:
install_requires.append("attrs < 22")
install_requires.append("backports.functools-lru-cache < 2")
install_requires.append("beautifulsoup4 < 4.10")
install_requires.append("plone.restapi < 8.0.0")
# There is a py2-imcompatibility in plone.rest 3.0.1
install_requires.append("plone.rest < 3.0.1")
# plone.restapi depends on plone.schema, which depends on jsonschema,
# which has a Py3-only release since September 2021.
install_requires.append("jsonschema < 4")
install_requires.append("pyrsistent < 0.16.0")
install_requires.append("pathlib2")
install_requires.append("plone.api >= 1.8.4, < 2")
# There is a py2-imcompatibility in plone.rest 3.0.1
install_requires.append("plone.rest < 3.0.1")
install_requires.append("plone.restapi < 8")
install_requires.append("plone.schema < 2")
install_requires.append("PyJWT < 2")
install_requires.append("pyrsistent < 0.16.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me like you're adding pins for Plone 4, but doing it based on the presence of Python 2. It is also possible to use Python 2 with Plone 5.1 and 5.2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I‌ tested only in Plone 4.
But above these thresholds there is only Python 3 support - also for plone.schema, plone.restapi and plone.api.
I think this should be safe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thet I think you are right.

else:
install_requires.append("plone.restapi")
install_requires.append("beautifulsoup4")
install_requires.append("plone.api >= 1.8.4")
install_requires.append("plone.restapi")


setup(
Expand Down