Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use aq_inner before aq_parent at some places to safely get the parent #23

Merged
merged 1 commit into from Feb 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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