Skip to content

Commit

Permalink
Use aq_inner before aq_parent at some places to safely get the parent
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed Feb 4, 2017
1 parent 055cd35 commit 9b65abf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,9 @@ Changelog
4.0a4 (unreleased)
------------------

- Use aq_inner before aq_parent at some places to safely get the parent
[MrTango]


4.0a3 (2017-02-02)
------------------
Expand Down
3 changes: 2 additions & 1 deletion src/Products/ZCatalog/CatalogBrains.py
Expand Up @@ -14,6 +14,7 @@
from Acquisition import aq_base
from Acquisition import aq_get
from Acquisition import aq_parent
from Acquisition import aq_inner
from Acquisition import Implicit
from Record import Record
from zope.globalrequest import getRequest
Expand All @@ -38,7 +39,7 @@ def __contains__(self, name):

def getPath(self):
"""Get the physical path for this record"""
return aq_parent(self).getpath(self.data_record_id_)
return aq_parent(aq_inner(self)).getpath(self.data_record_id_)

def getURL(self, relative=0):
"""Generate a URL for this record"""
Expand Down
6 changes: 4 additions & 2 deletions src/Products/ZCatalog/ZCatalogIndexes.py
Expand Up @@ -17,6 +17,7 @@
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.Permissions import manage_zcatalog_indexes
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Acquisition import Implicit
from App.special_dtml import DTMLFile
Expand Down Expand Up @@ -65,14 +66,14 @@ def _delOb(self, id):
aq_base(aq_parent(self))._indexes = indexes

def _getOb(self, id, default=_marker):
indexes = aq_parent(self)._catalog.indexes
indexes = aq_parent(aq_inner(self))._catalog.indexes
if default is _marker:
return indexes.get(id)
return indexes.get(id, default)

security.declareProtected(manage_zcatalog_indexes, 'objectIds')
def objectIds(self, spec=None):
indexes = aq_parent(self)._catalog.indexes
indexes = aq_parent(aq_inner(self))._catalog.indexes
if spec is not None:
if isinstance(spec, str):
spec = [spec]
Expand Down Expand Up @@ -105,6 +106,7 @@ def __bobo_traverse__(self, REQUEST, name):

return getattr(self, name)


InitializeClass(ZCatalogIndexes)


Expand Down

0 comments on commit 9b65abf

Please sign in to comment.