Skip to content

Commit

Permalink
remove dolmen.builtins dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
papachoco committed Jun 14, 2017
1 parent e9d13ef commit db10876
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
==================

- Nothing changed yet.
- remove dolmen.builtins dependency


1.0.0 (2016-08-19)
Expand Down
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def _read(fname):
],
extras_require={
'test': TESTS_REQUIRE,
':python_version == "2.7"': [
# Not ported to Py3
'dolmen.builtins',
],
},
entry_points=entry_points,
)
18 changes: 11 additions & 7 deletions src/nti/contentfragments/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
unicode = str
PY2 = False

import sys

from zope import component
from zope import interface

Expand Down Expand Up @@ -48,13 +50,15 @@ def _setup():
zc_add_files([mime_map_file])
_setup()

try:
from dolmen.builtins import IUnicode, IString
except (ImportError, NameError):
# Py3
# We get NameError if it is installed, but still tries to use
# `unicode` and fails.
assert unicode is str
if sys.version_info[0] <= 2:
class IString(interface.Interface):
"""Marker interface for mutable strings."""
interface.classImplements(bytes, IString)

class IUnicode(interface.Interface):
"""Marker interface for unicode strings."""
interface.classImplements(unicode, IUnicode)
else:
class IUnicode(interface.Interface):
"""Marker interface for unicode strings"""
interface.classImplements(str, IUnicode)
Expand Down

0 comments on commit db10876

Please sign in to comment.