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

Imports are Python3 compatible #390

Merged
merged 1 commit into from
Oct 22, 2017
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 @@ -14,6 +14,9 @@ Bug fixes:
In cases of a 404 page, the context is a browser view.
[thet]

- Imports are Python3 compatible
[b4oshany]


2.0rc8 (2017-09-05)
-------------------
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from setuptools import find_packages
from setuptools import setup


version = '2.0rc9.dev0'

Expand Down Expand Up @@ -39,13 +41,14 @@
zip_safe=False,
install_requires=[
'setuptools',
'six',
'plone.subrequest>=1.8',
'plone.tiles>=1.8.3',
'plone.app.blocks>=4.1.0',
'plone.app.tiles>=3.0.3',
'plone.app.drafts>=1.1.2',
'plone.app.standardtiles>=2.2.0',
'Products.CMFPlone>=5.0.4'
'Products.CMFPlone>=5.0.4',
],
extras_require={'test': [
'plone.app.testing',
Expand Down
5 changes: 3 additions & 2 deletions src/plone/app/mosaic/browser/editor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from AccessControl import getSecurityManager
from AccessControl import Unauthorized
from ConfigParser import SafeConfigParser
from plone import api
from plone.app.blocks.interfaces import CONTENT_LAYOUT_MANIFEST_FORMAT
from plone.app.blocks.interfaces import CONTENT_LAYOUT_RESOURCE_NAME
Expand All @@ -15,12 +14,14 @@
from plone.registry.interfaces import IRegistry
from plone.resource.manifest import MANIFEST_FILENAME
from plone.resource.utils import queryResourceDirectory
from six.moves.configparser import SafeConfigParser
from zExceptions import NotFound
from zope.component import getUtility
from zope.publisher.browser import BrowserView

import io
import json
import six


def loadManifest(data):
Expand Down Expand Up @@ -244,7 +245,7 @@ def hide(self):
hidden = registry['plone.app.mosaic.hidden_content_layouts']
key = self.request.form.get('layout')
if key and key not in hidden:
hidden.append(unicode(key))
hidden.append(six.text_type(key))
registry['plone.app.mosaic.hidden_content_layouts'] = hidden

def get_layout_id(self, layout):
Expand Down
2 changes: 1 addition & 1 deletion src/plone/app/mosaic/browser/layoutmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from plone.protect.utils import addTokenToUrl
from Products.CMFDynamicViewFTI.interfaces import ISelectableBrowserDefault
from Products.CMFPlone.utils import parent
from urllib import quote
from six.moves.urllib.parse import quote
from zExceptions import NotFound
from zope.browsermenu.interfaces import IBrowserMenu
from zope.browsermenu.menu import BrowserMenu
Expand Down
9 changes: 5 additions & 4 deletions src/plone/app/mosaic/browser/main_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from repoze.xmliter.utils import getHTMLSerializer
from urlparse import unquote
from urlparse import urljoin
from six.moves.urllib.parse import unquote
from six.moves.urllib.parse import urljoin
from zExceptions import NotFound
from zope.component import getMultiAdapter
from zope.interface import alsoProvides
Expand All @@ -24,6 +24,7 @@
import os
import pkg_resources
import re
import six


NSMAP = {'metal': 'http://namespaces.zope.org/metal'}
Expand Down Expand Up @@ -54,7 +55,7 @@


def cook_layout_cachekey(func, layout, ajax):
if isinstance(layout, unicode):
if isinstance(layout, six.text_type):
layout = layout.encode('utf-8', 'replace')
return md5(layout).hexdigest(), ajax

Expand Down Expand Up @@ -138,7 +139,7 @@ def cook_layout(layout, ajax):
layout = re.sub('\r', '\n', re.sub('\r\n', '\n', layout))

# Parse layout
if isinstance(layout, unicode):
if isinstance(layout, six.text_type):
result = getHTMLSerializer([layout.encode('utf-8')], encoding='utf-8')
else:
result = getHTMLSerializer([layout], encoding='utf-8')
Expand Down
2 changes: 1 addition & 1 deletion src/plone/app/mosaic/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from plone.app.mosaic.utils import getPersistentResourceDirectory
from plone.resource.manifest import MANIFEST_FILENAME
from Products.CMFPlone.interfaces import INonInstallable
from StringIO import StringIO
from six import StringIO
from zope.component import getUtility
from zope.interface import alsoProvides
from zope.interface import implementer
Expand Down