Skip to content

Commit

Permalink
More import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ale-rt authored and Michael Howitz committed Apr 24, 2018
1 parent 7dd09d2 commit 782715e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions Products/ExternalEditor/ExternalEditor.py
Expand Up @@ -16,8 +16,11 @@

# Zope External Editor Product by Casey Duncan

from string import join # For Zope 2.3 compatibility
import types
try:
from string import join # For Zope 2.3 compatibility
except ImportError:
# Python 3
join = str.join
from Acquisition import aq_inner, aq_base, aq_parent, Implicit
try:
from App.class_init import InitializeClass
Expand All @@ -36,20 +39,17 @@
def wl_isLocked(ob):
return 0

from zExceptions import BadRequest
from ZPublisher.Iterators import IStreamIterator
from zope.interface import implements, Interface
HAVE_Z3_IFACE = issubclass(IStreamIterator, Interface)
from zope.interface import implementer, Interface

ExternalEditorPermission = 'Use external editor'

_callbacks = []


@implementer(IStreamIterator)
class PDataStreamIterator:
if HAVE_Z3_IFACE:
implements(IStreamIterator)
else:
__implements__ = IStreamIterator

def __init__(self, data):
self.data = data
Expand Down Expand Up @@ -222,10 +222,9 @@ def index_html(self, REQUEST, RESPONSE, path=None):
body = ob.read()
else:
# can't read it!
raise 'BadRequest', 'Object does not support external editing'
raise BadRequest('Object does not support external editing')

if (HAVE_Z3_IFACE and IStreamIterator.providedBy(body) or
(not HAVE_Z3_IFACE) and IStreamIterator.isImplementedBy(body)):
if IStreamIterator.providedBy(body):
# We need to manage our content-length because we're streaming.
# The content-length should have been set in the response by
# the method that returns the iterator, but we need to fix it up
Expand Down
2 changes: 1 addition & 1 deletion Products/ExternalEditor/__init__.py
Expand Up @@ -20,7 +20,7 @@
from OFS.FindSupport import FindSupport
from OFS.Folder import Folder
from App.Management import Tabs
from ExternalEditor import ExternalEditor, EditLink
from Products.ExternalEditor.ExternalEditor import ExternalEditor, EditLink

# Add the icon and the edit method to the misc_ namespace

Expand Down

0 comments on commit 782715e

Please sign in to comment.