Skip to content

Commit

Permalink
first steps to make it work in python3
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Feb 9, 2019
1 parent e6f8313 commit 77f9e3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
setup(
name='collective.isotope',
version='0.1-dev',
description="A view for folders and collections using the Isotope jquery plugin",
description="Plone view for folders and collections using the Isotope "
"jquery plugin",
long_description=long_description,
# Get more from http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
"Environment :: Web Environment",
"Framework :: Plone",
"Framework :: Plone :: 5.0",
"Framework :: Plone :: 5.2",
"Framework :: Plone :: 5.2",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Operating System :: OS Independent",
Expand All @@ -42,9 +45,10 @@
include_package_data=True,
zip_safe=False,
install_requires=[
'collective.z3cform.datagridfield',
'plone.api',
'setuptools',
'collective.z3cform.datagridfield',
'six',
],
extras_require={
'test': [
Expand Down
15 changes: 6 additions & 9 deletions src/collective/isotope/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
from ..interfaces import IValueConverter
from collective.isotope import _
from itertools import chain
from itertools import ifilter
from itertools import imap
from itertools import izip

# from plone import api
from plone.app.contenttypes.browser.collection import CollectionView
from plone.app.contenttypes.browser.folder import FolderView
from plone.i18n.normalizer.interfaces import IIDNormalizer
Expand All @@ -30,6 +25,7 @@

import collections
import json
import six.moves


ISOTOPE_CONFIGURATION_KEY = 'collective.isotope.configuration'
Expand Down Expand Up @@ -198,7 +194,8 @@ def _get_sorts_label(self, column):
return self._get_column_label(column, 'sorts')

def _get_column_label(self, column, type_):
"""return the label for a given column name from the named vocabulary"""
"""return the label for a given column name from the named vocabulary
"""
name = 'collective.isotope.vocabularies.available_{}'.format(type_)
factory = queryUtility(IVocabularyFactory, name=name, default=None)
if factory is not None:
Expand All @@ -223,12 +220,12 @@ def _get_filter_values(self, filter, raw):
converter = queryUtility(
IValueConverter, name=converter_name, default=None
)
values = imap(self.normalizer.normalize, raw)
values = six.moves.map(self.normalizer.normalize, raw)
labels = raw
if converter:
labels = imap(converter, raw)
labels = six.moves.map(converter, raw)

return ifilter(lambda x: x[1], izip(values, labels))
return six.moves.filter(lambda x: x[1], six.moves.zip(values, labels))


class IsotopeCollectionView(IsotopeViewMixin, CollectionView):
Expand Down
5 changes: 3 additions & 2 deletions src/collective/isotope/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from plone.registry import field
from z3c.form.interfaces import NO_VALUE
from zope import schema
from zope.interface import implements
from zope.interface import implementer
from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer

Expand All @@ -31,8 +31,9 @@ def convert(value):


# A DictRow is an IDict for import/export purposes
@implementer(schema.interfaces.IDict)
class ImportableTextDictRow(DictRow, schema.MinMaxLen):
implements(schema.interfaces.IDict)

# We treat all values as text for simplicity of import/export.
# Unfortunately, non-text values will result in duplicates when
# purge="False"
Expand Down

0 comments on commit 77f9e3d

Please sign in to comment.