Skip to content

Commit

Permalink
adjust ReplaceableWrapper to work in Zope 4
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Nov 6, 2017
1 parent 1c6084c commit 7edcb75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ New features:

Bug fixes:

- *add item here*
- Fix webdav PUT of index_html to work in Zope 4.
[davisagli]


1.2.3 (2017-03-27)
Expand Down
11 changes: 8 additions & 3 deletions src/plone/app/folder/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
from webdav.NullResource import NullResource
from zope.interface import implementer
from App.class_init import InitializeClass
import Acquisition

# to keep backward compatibility
has_btree = 1


class ReplaceableWrapper:
class ReplaceableWrapper(Acquisition.Implicit):
""" a wrapper around an object to make it replaceable """

def __init__(self, ob):
Expand All @@ -28,6 +29,9 @@ def __getattr__(self, name):
return REPLACEABLE
return getattr(self.__ob, name)

def __repr__(self):
return repr(aq_base(self.__ob))


@implementer(IOrderedContainer)
class BaseBTreeFolder(OrderedBTreeFolderBase, BaseFolder):
Expand Down Expand Up @@ -74,8 +78,9 @@ def index_html(self, REQUEST=None, RESPONSE=None):
else:
raise AttributeError('index_html')
# Acquire from parent
target = aq_parent(aq_inner(self)).aq_acquire('index_html')
return ReplaceableWrapper(aq_base(target).__of__(self))
parent = aq_parent(aq_inner(self))
target = parent.aq_acquire('index_html')
return ReplaceableWrapper(aq_base(target)).__of__(parent).__of__(self)

index_html = ComputedAttribute(index_html, 1)

Expand Down

0 comments on commit 7edcb75

Please sign in to comment.