Skip to content

Commit

Permalink
[fc] Repository: plone.api
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2017-10-22T15:26:09+02:00
Author: Ruda Porto Filgueiras (rudaporto) <rudazz@gmail.com>
Commit: plone/plone.api@6224970

Python 2 / 3 compatible imports.

Files changed:
M CHANGES.rst
M setup.py
M src/plone/api/portal.py
Repository: plone.api

Branch: refs/heads/master
Date: 2017-10-24T23:39:56+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.api@1265a9b

Merge pull request #394 from plone/py3_imports

Python 2 / 3 compatible imports

Files changed:
M CHANGES.rst
M setup.py
M src/plone/api/portal.py
  • Loading branch information
mauritsvanrees committed Oct 24, 2017
1 parent 877dc00 commit 7434918
Showing 1 changed file with 124 additions and 238 deletions.
362 changes: 124 additions & 238 deletions last_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,259 +2,145 @@ Repository: plone.api


Branch: refs/heads/master
Date: 2017-10-20T14:22:02+02:00
Author: Roel Bruggink (jaroel) <roel@jaroel.nl>
Commit: https://github.com/plone/plone.api/commit/7da76d52d37a8bc85d4141895d438281e9b8b66e
Date: 2017-10-22T15:26:09+02:00
Author: Ruda Porto Filgueiras (rudaporto) <rudazz@gmail.com>
Commit: https://github.com/plone/plone.api/commit/6224970b5855417a483959718973811aa39e35ae

Clear up buildout so bin/buildout at least works
Python 2 / 3 compatible imports.

Files changed:
A base.cfg
M buildout.cfg
M plone-4.3.x.cfg
M plone-5.0.x.cfg
M plone-5.1.x.cfg
M CHANGES.rst
M setup.py
M src/plone/api/portal.py

diff --git a/base.cfg b/base.cfg
new file mode 100644
index 0000000..ccb3c94
--- /dev/null
+++ b/base.cfg
@@ -0,0 +1,26 @@
+[buildout]
+package-name = plone.api
+package-extras = [test]
+test-eggs =
+ plone.api
+
+parts +=
+ omelette
+
+# network speedup
+socket-timeout = 5
+allow-hosts =
+ *.python.org
+ docutils.sourceforge.net
+ prdownloads.sourceforge.net
+ effbot.org
+ dist.plone.org
+
+[versions]
+plone.api =
+setuptools = 33.1.1
+zc.buildout = 2.8.0
+
+[omelette]
+recipe = collective.recipe.omelette
+eggs = ${test:eggs}
diff --git a/buildout.cfg b/buildout.cfg
index 84bb9ec..464b24b 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -1,22 +1,2 @@
[buildout]
-
-package-name = plone.api
-package-extras = [test]
-test-eggs =
- plone.api
-
-parts +=
- omelette
-
-# network speedup
-socket-timeout = 5
-allow-hosts =
- *.python.org
- docutils.sourceforge.net
- prdownloads.sourceforge.net
- effbot.org
- dist.plone.org
-
-[omelette]
-recipe = collective.recipe.omelette
-eggs = ${test:eggs}
+extends = plone-5.1.x.cfg
diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg
index 0cadbac..1661cec 100644
--- a/plone-4.3.x.cfg
+++ b/plone-4.3.x.cfg
@@ -1,10 +1,4 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
- buildout.cfg
-
-[versions]
-plone.api =
-
-setuptools = 33.1.1
-zc.buildout = 2.8.0
+ base.cfg
diff --git a/plone-5.0.x.cfg b/plone-5.0.x.cfg
index c4fd7db..ea52eaa 100644
--- a/plone-5.0.x.cfg
+++ b/plone-5.0.x.cfg
@@ -1,10 +1,5 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.0.x.cfg
- buildout.cfg
-
-[versions]
-plone.api =
-
-setuptools = 33.1.1
-zc.buildout = 2.8.0
+ base.cfg
+
\ No newline at end of file
diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg
index 0b55693..7d78352 100644
--- a/plone-5.1.x.cfg
+++ b/plone-5.1.x.cfg
@@ -1,10 +1,4 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.1.x.cfg
- buildout.cfg
-
-[versions]
-plone.api =
-
-setuptools = 33.1.1
-zc.buildout = 2.8.0
+ base.cfg
diff --git a/CHANGES.rst b/CHANGES.rst
index 93a98dd..5eeccac 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -22,6 +22,8 @@ Bug fixes:
- Change api.group.get_groups to work with CMF master.
[jaroel]

+- Added six to deal with Python 2 / 3 compatibility.
+ [rudaporto]

1.8.1 (2017-10-17)
------------------
diff --git a/setup.py b/setup.py
index 58c3e61..f8125b0 100644
--- a/setup.py
+++ b/setup.py
@@ -38,6 +38,7 @@ def read(*rnames):
'plone.app.linkintegrity',
'plone.uuid',
'setuptools',
+ 'six',
'zope.globalrequest',
],
extras_require={
diff --git a/src/plone/api/portal.py b/src/plone/api/portal.py
index 81e86cc..eada107 100644
--- a/src/plone/api/portal.py
+++ b/src/plone/api/portal.py
@@ -21,6 +21,7 @@
from zope.interface.interfaces import IInterface

import pkg_resources
+import six


logger = getLogger('plone.api.portal')
@@ -191,7 +192,7 @@ def send_email(

# If the mail headers are not properly encoded we need to extract
# them and let MailHost manage the encoding.
- if isinstance(body, unicode):
+ if isinstance(body, six.text_type):
body = body.encode(encoding)

host = get_tool('MailHost')
@@ -441,7 +442,7 @@ def translate(msgid, domain='plone', lang=None):
:param lang: target language
:type lang: string
:returns: translated message
- :rtype: unicode
+ :rtype: six.text_type
:Example: :ref:`portal_translate_example`
"""
translation_service = get_tool('translation_service')


Repository: plone.api


Branch: refs/heads/master
Date: 2017-10-24T23:32:37+02:00
Date: 2017-10-24T23:39:56+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.api/commit/ec5611b21e13abc67950c64f9c851940c5560bd3
Commit: https://github.com/plone/plone.api/commit/1265a9b7896ffd073b343b690228e03ae22902e2

Merge pull request #391 from plone/clearup_buildouts
Merge pull request #394 from plone/py3_imports

Clear up buildout so bin/buildout at least works
Python 2 / 3 compatible imports

Files changed:
A base.cfg
M buildout.cfg
M plone-4.3.x.cfg
M plone-5.0.x.cfg
M plone-5.1.x.cfg
M CHANGES.rst
M setup.py
M src/plone/api/portal.py

diff --git a/base.cfg b/base.cfg
new file mode 100644
index 0000000..ccb3c94
--- /dev/null
+++ b/base.cfg
@@ -0,0 +1,26 @@
+[buildout]
+package-name = plone.api
+package-extras = [test]
+test-eggs =
+ plone.api
+
+parts +=
+ omelette
+
+# network speedup
+socket-timeout = 5
+allow-hosts =
+ *.python.org
+ docutils.sourceforge.net
+ prdownloads.sourceforge.net
+ effbot.org
+ dist.plone.org
+
+[versions]
+plone.api =
+setuptools = 33.1.1
+zc.buildout = 2.8.0
+
+[omelette]
+recipe = collective.recipe.omelette
+eggs = ${test:eggs}
diff --git a/buildout.cfg b/buildout.cfg
index 84bb9ec..464b24b 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -1,22 +1,2 @@
[buildout]
-
-package-name = plone.api
-package-extras = [test]
-test-eggs =
- plone.api
-
-parts +=
- omelette
-
-# network speedup
-socket-timeout = 5
-allow-hosts =
- *.python.org
- docutils.sourceforge.net
- prdownloads.sourceforge.net
- effbot.org
- dist.plone.org
-
-[omelette]
-recipe = collective.recipe.omelette
-eggs = ${test:eggs}
+extends = plone-5.1.x.cfg
diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg
index 0cadbac..1661cec 100644
--- a/plone-4.3.x.cfg
+++ b/plone-4.3.x.cfg
@@ -1,10 +1,4 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
- buildout.cfg
-
-[versions]
-plone.api =
-
-setuptools = 33.1.1
-zc.buildout = 2.8.0
+ base.cfg
diff --git a/plone-5.0.x.cfg b/plone-5.0.x.cfg
index c4fd7db..ea52eaa 100644
--- a/plone-5.0.x.cfg
+++ b/plone-5.0.x.cfg
@@ -1,10 +1,5 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.0.x.cfg
- buildout.cfg
-
-[versions]
-plone.api =
-
-setuptools = 33.1.1
-zc.buildout = 2.8.0
+ base.cfg
+
\ No newline at end of file
diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg
index 0b55693..7d78352 100644
--- a/plone-5.1.x.cfg
+++ b/plone-5.1.x.cfg
@@ -1,10 +1,4 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.1.x.cfg
- buildout.cfg
-
-[versions]
-plone.api =
-
-setuptools = 33.1.1
-zc.buildout = 2.8.0
+ base.cfg
diff --git a/CHANGES.rst b/CHANGES.rst
index 93a98dd..5eeccac 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -22,6 +22,8 @@ Bug fixes:
- Change api.group.get_groups to work with CMF master.
[jaroel]

+- Added six to deal with Python 2 / 3 compatibility.
+ [rudaporto]

1.8.1 (2017-10-17)
------------------
diff --git a/setup.py b/setup.py
index 58c3e61..f8125b0 100644
--- a/setup.py
+++ b/setup.py
@@ -38,6 +38,7 @@ def read(*rnames):
'plone.app.linkintegrity',
'plone.uuid',
'setuptools',
+ 'six',
'zope.globalrequest',
],
extras_require={
diff --git a/src/plone/api/portal.py b/src/plone/api/portal.py
index 81e86cc..eada107 100644
--- a/src/plone/api/portal.py
+++ b/src/plone/api/portal.py
@@ -21,6 +21,7 @@
from zope.interface.interfaces import IInterface

import pkg_resources
+import six


logger = getLogger('plone.api.portal')
@@ -191,7 +192,7 @@ def send_email(

# If the mail headers are not properly encoded we need to extract
# them and let MailHost manage the encoding.
- if isinstance(body, unicode):
+ if isinstance(body, six.text_type):
body = body.encode(encoding)

host = get_tool('MailHost')
@@ -441,7 +442,7 @@ def translate(msgid, domain='plone', lang=None):
:param lang: target language
:type lang: string
:returns: translated message
- :rtype: unicode
+ :rtype: six.text_type
:Example: :ref:`portal_translate_example`
"""
translation_service = get_tool('translation_service')


0 comments on commit 7434918

Please sign in to comment.