Skip to content

Commit

Permalink
More import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ale-rt committed Mar 21, 2018
1 parent 7ff5691 commit 4396480
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 4396480

Please sign in to comment.